Locale message tokens

Sometimes it is tedious to create a separate CXP page for each locale. A better idea would be to store the multilingual text independently of your source code and retrieved it dynamically.
This sample consists of two files: locale-tokens.cxp and locale-tokens.cxp.locale. The locale-tokens.cxp.locale file is an XML file that has the multilingual text divided into locale-specific messages and can be easily extended. The locale-tokens.cxp file is an CXP page and has text constants inside the source code that can be expressed in a locale agnostic way. It outputs messages in different languages depending on the language selected in the browser. This is achieved by using the L"" locale string delimiter for the language agnostic strings. Also you can use the helper function LocaleMessage({cToken}, SELF) within your CXP page to use locale message strings via message tokens coming from a table or variable.
Note: Remember that the locale file must be named after the CXP page associated with, but has a .locale postfix as a part of the filename.
This solution is the best fit for the scenario, when your CXP pages create dynamic content.

Related articles:
Run in new tab
Live editor
Result built with V2 2156
I'm a warning toast!
I'm a success toast!