Hi everyone,
We have a multilingual project in AEM 6.5 in which we need to show pages in the following languages:
All of these languages but Valencian have ISO codes.
Valencian is linguistically considered a variant of Catalan language but politically it is considered an independent language in Spain. (https://en.wikipedia.org/wiki/Valencian_language).
In Java it is identified with the variant code "ca_ES_VALENCIA".
We have organized our project using the following tree:
We are using i18n dictionaries in json format and all of them but for Valencian are working fine.
This was expected as AEM only supports OOTB ISO languages.
We now need to make it work for Valencian. How could we do this?
We have found some promissing documentation regarding adding languages to AEM but it has not worked as expected.
We have followed these steps to add Valencian as a language in AEM (https://experienceleague.adobe.com/docs/experience-manager-65/developing/extending-aem/extending-msm...) and indeed we can now set the "language" property (jcr:language) of a page (/content/client/language-masters/va) as Valencian.
A screenshot showing that we have Valencian as an available language.
A screenshot showing we can set the jcr:language property of a page to "va".
The problem is that com.day.cq.wcm.api.Page.getLanguage() is not returning "va" (getting it from the path nor from the property) but "es_ES", the value of my request's "Accept-Language" header.
In the official documentation for this method (https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/Pa...) it says:
"The language is usually defined on the page content via a jcr:language property containing the iso codes for language and country. if the property is not defined on this page all ancestors are search for such an property. If no language is defined at all, the path is examined if it contains a iso label. If no language can be found at all, the systems default locale is returned. Note that this has nothing to do with i18n of the cq5 itself."
So, how could we do it for Valencian to work as any other language in AEM 6.5?
Thanks in advance.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
If the Valencian does not have an ISO code, then the limitation goes beyond AEM. This becomes tricky if JAVA does not support this ISO, so I think you need to use a workaround to implement this solution. Below are some ideas you could use:
- Use a different language in the "jcr:language" and treat this as if it was Valencian. You will have to adjust the backend and most likely the dispatcher configs to properly match the other language to "va"
- Extend the languages as you were doing to add the Valencian language, then manually create your own getLanguage() method which will get manually the "jcr:language" and check firstly if your value is "va" to return your expected value otherwise just let the original getLanguage() method to run.
Hopefully, it gives you some insights.
If the Valencian does not have an ISO code, then the limitation goes beyond AEM. This becomes tricky if JAVA does not support this ISO, so I think you need to use a workaround to implement this solution. Below are some ideas you could use:
- Use a different language in the "jcr:language" and treat this as if it was Valencian. You will have to adjust the backend and most likely the dispatcher configs to properly match the other language to "va"
- Extend the languages as you were doing to add the Valencian language, then manually create your own getLanguage() method which will get manually the "jcr:language" and check firstly if your value is "va" to return your expected value otherwise just let the original getLanguage() method to run.
Hopefully, it gives you some insights.
Views
Likes
Replies
Views
Likes
Replies