I'm new here

Is it possible to find the selected language in page


In my project, I have many language tabs and page will be activated for few langauges only. I want to find the selected langauge only.

Is it possible to get the selected or activated language in the page through bean shell ?

10 Replies
Crownpeak employee

No, there is no property for this. Could you explain your use case?

0 Kudos

Hello Jodeleit,

I have two langauge selected the in the page, is there any way to get the selected language of the page


0 Kudos


on page level this option means whether a page in this language is fully translated or not.
When you already have the page object, there is a method for that which returns a boolean:

myPageObject.isTranslated;            //from Master langauge

myPageObject.isTranslated("EN")  //from a specific language; english here 

Does that help you?



0 Kudos

Hello Teichmann,

the above example is fine for you few language but i have 15 languages in my project and i have to write many if's. Is there any way to avoid that ??

0 Kudos
Crownpeak employee


you can iterate through the languages of your project, check for each language if it's translated (as Jascha pointed out), and save these languages in a list. So it doesn't matter how many languages you have.

Best regards


0 Kudos
New Creator


in which context do you want to trigger the bean shell script? What is your intention?

If you want to get the current form language (as your screenshot suggests) this might be difficult.



0 Kudos

Hello All,

I got the code from Mr. Culley. please find the below code 



             <a href="$CMS_REF(#global.node,lang:for_lang)$">




the abiove code is to filter only the selected language for the page.


in beanshell you can get your languages via a LanguageAgent. You can get your LanguageAgent from the scriptContext, for example:

languageAgent = context.requireSpecialist(LanguageAgent.TYPE);

then you can get the languages with:

languages = languageAgent.getLanguages();

Finally you iterate through your languages and check if they are translated or not:

for(lang : languages){

     if (myPageObject.isTranslated(lang)){

          //do something if it is set as translated


          //do something if the page is not set as translated for this language


Is that what you intended to do?



Nachricht geändert durch Jascha Teichmann


has the answer helped you or are there some more questions?

Best regads


0 Kudos