Multi-language
Set or reset the user's language for Kompassify content via the Player API.
Waiting for Kompassify API to be ready
It is highly recommended to wait for the Kompassify API Script to be fully loaded before calling any of the API functions.
The event KOMPASSIFY_BOOT_LOADER_IS_READY is dispatched when the Kompassify API is ready to be used.
window.addEventListener('message', function (event) {
if (event.data.TYPE === "KOMPASSIFY_BOOT_LOADER_IS_READY") {
// Do your stuff here
}
});
How to set user language
By default, Kompassify uses the user's browser language. You can override this programmatically by calling:
window.kompassifyMultiLanguage.setUserLanguage(languageCode); // e.g. 'fr', 'de'
Parameters
| Property | Type | Description |
|---|---|---|
| ISO_639-1_LANGUAGE_CODE | String | Two-letter ISO language code, e.g. 'fr' or 'de'. For the full list see the Wikipedia ISO 639-1 codes page. |
Resetting multi-language to default behavior
You can reset the language to use the user's browser language by calling:
window.kompassifyMultiLanguage.resetUserLanguage();