Switching locales programmatically

The CXP core optionally supports managing the locale independently of your browser settings on a user-specific level. In other words, any CXP application can overwrite the browser settings via the :application object of a CXP page.
This sample consists of two files: locale-programmatically.cxp and locale-programmatically.cxp.locale. The locale-programmatically.cxp.locale has locale-specific messages and is used in locale-programmatically.cxp. The locale-programmatically.cxp is an CXP page that allows users to change a locale. To define and set a locale is used the cookie CxcUserLocale that is sent in each request. Based on the CxcUserLocale value the application variable :application:currentUserLocale is getting changed that results in switching browser's language.
This solution is the best fit for the scenario, when you may want to provide the users of your web application with a way for changing the locale.

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