Expand my Community achievements bar.

SOLVED

Fetch list of language copies for a particular page programmatically

Avatar

Level 2

I want to know all the language copies available or created for a particular page.

say, a particular page are in two different languages french and dutch. 

if i select french page , how can i know programmatically know that dutch copy of this page also exist?

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

You can make use of "PageInfo" servlet to obtain page information in JSON format.

Example:- http://localhost:4502/libs/wcm/core/content/pageinfo.json?path=/content/geometrixx/

It will return JSON values, 

Link:- 

"languages":{  
      "rows":[  
         {  
            "path":"/content/geometrixx/en",
            "exists":true,
            "hasContent":true,
            "lastModified":0,
            "iso":"en",
            "country":"gb",
            "language":"English"
         },
         {  
            "path":"/content/geometrixx/fr",
            "exists":true,
            "hasContent":true,
            "lastModified":0,
            "iso":"fr",
            "country":"fr",
            "language":"French"
         },
         {  
            "path":"/content/geometrixx/de",
            "exists":true,
            "hasContent":true,
            "lastModified":0,
            "iso":"de",
            "country":"de",
            "language":"German"
         }.........So on

 

Here you can easily determine the all language copies available.

Documentation link:- https://docs.adobe.com/docs/en/aem/6-2/develop/components/pageinfo.html

I hope this would help you.

~kautuk



Kautuk Sahni

View solution in original post

3 Replies

Avatar

Level 4

You can leverage the functionality of default servlet with selector as "language"

/content/geometrixx/en.languages.json?deep=false, with deep set as true, it will give the list of sub pages also.

Avatar

Correct answer by
Administrator

Hi 

You can make use of "PageInfo" servlet to obtain page information in JSON format.

Example:- http://localhost:4502/libs/wcm/core/content/pageinfo.json?path=/content/geometrixx/

It will return JSON values, 

Link:- 

"languages":{  
      "rows":[  
         {  
            "path":"/content/geometrixx/en",
            "exists":true,
            "hasContent":true,
            "lastModified":0,
            "iso":"en",
            "country":"gb",
            "language":"English"
         },
         {  
            "path":"/content/geometrixx/fr",
            "exists":true,
            "hasContent":true,
            "lastModified":0,
            "iso":"fr",
            "country":"fr",
            "language":"French"
         },
         {  
            "path":"/content/geometrixx/de",
            "exists":true,
            "hasContent":true,
            "lastModified":0,
            "iso":"de",
            "country":"de",
            "language":"German"
         }.........So on

 

Here you can easily determine the all language copies available.

Documentation link:- https://docs.adobe.com/docs/en/aem/6-2/develop/components/pageinfo.html

I hope this would help you.

~kautuk



Kautuk Sahni