Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

I18n for microsites

Dipti_Chauhan
Community Advisor
Community Advisor

Hello Experts

    Need your suggestion on i18n keys management for microsites sharing same code base as main site.

 

Currently we using hints to manage keys for microsite i.e

 

"key: {
"jcr:primaryType": "nt:folder",
"jcr:mixinTypes": [
"sling:Message",
"cq:ReplicationStatus"
],
"sling:message": "MESSAGE",
"sling:key": "key"
},
"key0: {
"jcr:primaryType": "nt:folder",
"jcr:mixinTypes": [
"sling:Message",
"cq:ReplicationStatus"
],
"sling:message": "MESSAGE1",
"sling:key": "key ((MICROSITE1))"
},
"key1: {
"jcr:primaryType": "nt:folder",
"jcr:mixinTypes": [
"sling:Message",
"cq:ReplicationStatus"
],
"sling:message": "MESSAGE2",
"sling:key": "key ((MICROSITE2))"
},

 

This approach creates unnecessary keys even if microsites sharing same message as main site.

Any other suggestions to manage this better?

 

Thanks

Dipti Chauhan

1 Reply
Asutosh_Jena_
Community Advisor
Community Advisor

Hi @Dipti_Chauhan 

 

If microsite and mainsite using the same key with same value, cannot we keep only once instance of key and use it?

Let's say we are using i18n using JSON:

 

{
"fNameKey": "First Name",
"fNameLabel": "First Name (optional)",
"lNameKey": "Last Name",
"lNameLabel": "Last Name (optional)"
}

Now if we want to use First Name in both Microsite and Mainsite, we can refer, "fNameKey" in both the site and it can be referred from same code base.

 

Am I missing anything here to understand the ask?

 

Thanks! 

Dipti_Chauhan
Community Advisor
Community Advisor

Hi @Asutosh_Jena_ 

  Microsite using same key but different value.

 

Thanks

Dipti

Asutosh_Jena_
Community Advisor
Community Advisor

Hi @Dipti_Chauhan 

 

If it's different value then you can use a separate JSON file which can contain the same key with different value and the content can be loaded dynamically based on the locale.

${'key' @ i18n, locale='mainsite'}
${'key' @ i18n, locale='microsite'}

mainsite.json

{
"fNameKey": "First Name",
"fNameLabel": "First Name (optional)",
"lNameKey": "Last Name",
"lNameLabel": "Last Name (optional)"
}  

 microsite.json

{
"fNameKey": "First Name with additional text",
"fNameLabel": "First Name (optional) with additional text",
"lNameKey": "Last Name with additional text",
"lNameLabel": "Last Name (optional) with additional text"
}

 Thanks!