Last updated
Last updated
Each localized page has access to JavaScript global object window.glopal
You can use it to determine if code is running on original or localized page:
Inside window.glopal.config.target
property you can find useful data about language and currency and localized page:
You can use them for dynamic customizations:
Glopal will automatically localize all visible content and links, even if it is updated dynamically after the initial page load.
Even that in general you don't need customizations to get localization of your website, in some specific cases it may be useful to have additional control. For example there could be analytics code that is not visible or elements of the UI that should be sorted where translating dynamic content before it is rendered can be useful. Glopal is exposign public API that can be used in site JavaScript code in such scenarios.
Method window.glopal.localizeUrl()
can be used to get localized links for the current site.
Method window.glopal.localize()
can be used to get translations inside your code:
If localizing visible elements, it is required to apply on already localized content to avoid double-localization.