In AEM 6.5 can we move i18n file from /apps/<project-structure>/i18n to /content/cq:i18n/<project-structure> and will it be supported in cloud?
Views
Replies
Total Likes
In AEM 6.5, it is possible to move your i18n files (dictionaries) from /apps//i18n to /content/cq:i18n/. Here’s what you need to know for both on-premise and cloud environments:
Source:
Views
Replies
Total Likes
Hey, I'm using this folder structure under /content/cq:i18n/rcg-structure/i18n/components but still not able to render i18n values on the pages. I am using this api for getting the i18n value. Can you please help me here?
I18n i18n = new I18n(request.getResourceBundle(pageLocale));
Views
Replies
Total Likes
Hi @VanitaNa ,
Based on your folder structure /content/cq:i18n/rcg-structure/i18n/components the problem seems to be with the hierarchy. That extra i18n folder in the path is likely causing the resource bundle to not be picked up, which is why the translations aren’t rendering.
When AEM resolves i18n strings using request.getResourceBundle(locale), it expects the dictionaries to be located directly under:
/content/cq:i18n/<project>/<dictionary>
So in your case, it should be something like:
/content/cq:i18n/rcg-structure/components/en.json
/content/cq:i18n/rcg-structure/components/en.json
And double-check the keys using /system/console/jcrresolver or in the logs. In my case, just fixing the folder structure solved everything.
Hope this helps.
Regards,
Amit
Views
Replies
Total Likes
Hey @AmitVishwakarma Thank you for your response.
I have added /content/cq:i18n path to org.apache.sling.i18n.impl.JcrResourceBundleProvider in author it started working. My question is now how can i replicate this configuration. Do i need to log in to each publisher and add this path?
Views
Replies
Total Likes
Hi @VanitaNa,
You do not need to manually log in to each publisher to configure the org.apache.sling.i18n.impl.JcrResourceBundleProvider
with the additional /content/cq:i18n
path.
You should include this configuration in your project codebase so it can be automatically deployed to Author and Publish environments.
1. Create/Update the OSGi config in your codebase under:
/apps/<your-project>/config.publish/com.day.cq.i18n.impl.JcrResourceBundleProvider~yourproject.cfg.json
Or using the new OSGi annotation-based format:
/apps/<your-project>/config.publish/org.apache.sling.i18n.impl.JcrResourceBundleProvider.cfg.json
2. Sample config file content:
{
"locale.default": "en",
"preload.bundles": false,
"invalidation.delay": 5000,
"included.paths": [
"/libs",
"/apps",
"/content/forms/af",
"/content/dam/formsanddocuments",
"/content/cq:i18n"
],
"excluded.paths": [
"/var/eventing"
]
}
Replace
/apps/myproject/i18n
with your actual path.
3. Create corresponding config.author/ directory too (if needed), or config
(for common settings across both).
Hope that helps!
Hi @VanitaNa,
I hope the response shared above helped address your question. If it did, please mark the most helpful one as "correct", this helps others in the community find helpful solutions more easily.
If you’re still facing any challenges, please feel free to continue the conversation here. We’re happy to support further.
Views
Replies
Total Likes
I tried using the same /content/cq:i18n/test-project/en.json, i dont see the data is rendering based on key
Views
Replies
Total Likes
@Shwetha1994 Can you check what is the rue you have in filter.xml? Probably It's not deploying. Alternatively, you can try updating locales here: /libs/cq/i18n/translator.html where you can selecting the dictionaries options from the drop down - modify the value and see if it reflects.
Views
Likes
Replies
Views
Likes
Replies