For the identification of languages, the framework uses a language code of type string.
Currently, SAPUI5 accepts the following syntax forms:
The language codes according to the de facto standard BCP-47, which are used by most browsers for language identification. As of JDK 1.7 they are also supported by the Java locale class.
Example: de, en-US, zh-Hans-CN
The Java Locale syntax that combines a lower case ISO 639 alpha-2 or alpha-3 language code with an ISO 3166 alpha-2 country code. Both codes are combined with an underscore. An arbitrary sequence of variant identifiers (also separated by underscores) can be appended as a third component.
Example: de, en_US, zh_TW_Traditional
The SAP proprietary language codes. SAPUI5 applications are often used to connect to ABAP-based SAP application servers. These servers use SAP proprietary language codes for compatibility reasons. These language codes often match an ISO 639 alpha-2 language code, but not in all cases. If the language code for a SAPUI5 application is specified with the traditional URL parameter sap-language, SAPUI5 assumes that it is a SAP proprietary language code and converts it to a BCP-47 language tag as follows:
SAP Language Code | BCP47 Language Tag | Description |
---|---|---|
ZH | zh-Hans | ZH is the SAP language code for Simplified Chinese. The most generic representation in BCP47 is zh-Hans. zh-CN (Chinese, China) is another representation, but SAPUI5 decided to use zh-Hans. |
ZF | zh-Hant | ZF is the SAP language code for Traditional Chinese. The most generic representation in BCP47 is zh-Hant. zh-TW (Chinese, Taiwan) is another representation, but SAPUI5 decided to use zh-Hant. |
1Q | en-US-x-saptrc | 1Q is a technical SAP language code used in support scenarios, for example for translation issues. When you select this language code, the technical keys are display instead of the actual data. As no ISO639 code for this exists, the information has been added as a BCP47 private extension to the en-US language tag: "trc" stands for "trace" or "traceability". |
2Q | en-US-x-sappsd | 2Q is also used as a technical SAP language code in support scenarios and displays a pseudo translation ("psd" in the private extensions name). |
SAPUI5 has the notion of a current language. It is determined from the following sources of information. The sources are ordered increasingly by priority and the last available user language/locale wins:
You use the configuration API to retrieve the resulting current language as follows:
#!js var sCurrentLocale = sap.ui.getCore().getConfiguration().getLanguage();