Expand my Community achievements bar.

SOLVED

how to get a node or page language?

Avatar

Former Community Member

For example: there is a node:/content/geometrixx/en/services, so you can see the page is English. But the developer how to use JCR API to get the language?

Anyone experience on it please comment here, thanks a lot.

1 Accepted Solution

Avatar

Correct answer by
Employee

If you have a Page object already, you can just do page.getLanguage(false). See http://docs.adobe.com/docs/fr/aem/6-0/develop/ref/javadoc/com/day/cq/wcm/api/Page.html#getLanguage(b...)

Regards,

Justin

View solution in original post

4 Replies

Avatar

Correct answer by
Employee

If you have a Page object already, you can just do page.getLanguage(false). See http://docs.adobe.com/docs/fr/aem/6-0/develop/ref/javadoc/com/day/cq/wcm/api/Page.html#getLanguage(b...)

Regards,

Justin

Avatar

Former Community Member

Thanks for your reply, How to get the jar to invoke it's method?

Avatar

Former Community Member

Now i get the jar, and i invode this method " LanguageUtil.getLanguageRoot(path)", but the result is not my need. For example: " LanguageUtil.getLanguageRoot(/content/geometrixx/en/services);" it will return "/content/geometrixx/en". Actually if there is any API to get language, like the country code or language name "en" "fr" and so on.