how to get a node or page language? | Community
Skip to main content
October 16, 2015
Solved

how to get a node or page language?

  • October 16, 2015
  • 4 replies
  • 3437 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JustinEd3

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(boolean)

Regards,

Justin

4 replies

JustinEd3Accepted solution
Employee
October 16, 2015

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(boolean)

Regards,

Justin

Illia_Kononov
New Participant
October 16, 2015

Hello,

You can use LanguageUtil.class.

October 16, 2015

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

October 16, 2015

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.