NSOA.context.getLanguage()
Use this function to get the user’s display language preference. You can then adapt your form scripts according to the user’s language preference and show translated versions of the same message, for example.
Parameters
-
(none)
Returns
-
A two-character string — the ISO 639–1 two-letter code for the language selected in the authenticated users’s personal settings, or
xx
, if the Show language keys view option is in use.Note:If the Multilanguage feature is not enabled, the function returns
en
.Language
Two-letter code
Chinese (Simplified)
zh
Czech
cs
English
en
French
fr
German
de
Japanese
ja
Spanish
es
Units Limit
-
0 units
For more information, see Scripting Governance.
Since
-
April 9, 2022
Example
-
This example creates a local variable called lang with the user’s language preference. It then uses conditional branching to display a message in the user’s preferred language.
// return user language code : en | fr | de | es | zh | ja | cs var lang = NSOA.context.getLanguage(); if (lang == 'cs') { // display messages in the Czech language" } if (lang == 'en') { // display messages in the English language" }