JavaScript customizations
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:
Configuration
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:
Content localization
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.
If localizing visible elements, it is required to apply gp-noloc
attributes on already localized content to avoid double-localization.
Link rewrite
Method window.glopal.localizeUrl()
can be used to get localized links for the current site.
Translations
Method window.glopal.localize()
can be used to get translations inside your code:
Last updated