It's all about the answers!

Ask a question

Access document generation language in RPE template

Privat Schneider (112) | asked Jul 12 '19, 5:35 a.m.
edited Jul 12 '19, 5:36 a.m.


I use a multilanguage RPE document template within the RTC document builder. The language of the output document reflects the language of the browser (e.g. Chrome). So far, so good. Further, I have some hardcoded strings (generated via scripts) in the RPE document template. How can I switch those strings based on the browser language?

I have searched the language information within the special variable "_sessionInfo" with no luck.

Of course, I could add an additional template variable for the language. But I hope for an automatic solution.

Best Regards

2 answers

permanent link
Subramanya Prasad Pilar (4.6k14) | answered Jul 15 '19, 5:08 a.m.
edited Jul 16 '19, 11:13 a.m.
I am afraid you cannot get the browser language value in RPE template so that it can be used in condition or script. You cannot use _sessionInfo.getDocspecProperty("property", "") either when you are using Document Builder.

Why can't you remove and add the template elements with hardcoded strings for each language?

permanent link
Subramanya Prasad Pilar (4.6k14) | answered Jul 12 '19, 12:00 p.m.
edited Jul 13 '19, 2:22 p.m.
RPE/Document Builder uses the OS/browser language. To get the user language, you can use the following expression in RPE template:

_sessionInfo can be used to get details like data source URL, username, etc., not locale details.

To set different language/locale (different from the system locale), you can use the metadata property "Output Locale". In Document Builder, click "Edit Advanced Configuration" for the report and you will find this property under Metadata tab.

Privat Schneider commented Jul 15 '19, 2:47 a.m.

Thanks for the answer. Unfortunately java.lang.System.getProperty("user.language") does not seem to meet my requirement. It does not reflect the OS/browser language. It seems to reflect the server language instead. E.g. the document is generated in German but java.lang.System.getProperty("user.language") gives me “en”.

Is there any way to access the OS/browser language? Basically, the language which is used to generate the document.

Your answer

Register or to post your answer.