Hi there,
There is a difficulty case to me: i wonder if there is a API to get locale code. E.g., when i get node "/content/geometrixx/fr/products/square", the API could return the "fr"(french); and when i get node "/content/geometrixx/en/services/banking", the api could return the "en" (English).
Anyone could help that? Thanks a lot.
Br,
Brian
Solved! Go to Solution.
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
It works, thank you so much.
But i wonder the principle that get the page locale information, and where do it find the language and counrtry of page exactly? I guess maybe one property saved that page locale information? Could you comment details? Thanks a lot.
Views
Replies
Total Likes
Hi,
The API documentation says:
Returns the content language of the page. 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. If ignoreConent
is true
, only the names of the path is used to determine the language. Note that this has nothing to do with i18n of the cq5 itself.
The "jcr:language" property is supposed to be on the "jcr:content" node on a page. And the methods checks if the page contains this property on its jcr:content node. If it isn't there, all ancestor pages are checked as well. And then some other assumptions kick in (like trying to interprete the parts of the paths as ISO codes).
Jörg
Views
Replies
Total Likes
Views
Likes
Replies