The Live UI has built in functionality to automatically detect a user's browser language and load the site in the given language.
This requires a file to exist for the user's language in this location:
Custom\Localization
When the site loads it sends a request for the text based on the browser's language settings.
DriveWorks will then stack the requested languages in preference order if they exist.
If a language doesn't exist DriveWorks will display in English.
To create a new translation:
System\Localization\LocalizedResources.json
Custom\Localization
LocalizedResources.[language code].json
The language codes used by the Live UI are based on ISO 639.
Example
Language | ISO 639 code | File name |
---|---|---|
繁體中文 | zh | LocalizedResources.zh.json |
Deutsch | de | LocalizedResources.de.json |
Español | es | LocalizedResources.es.json |
Français | fr | LocalizedResources.fr.json |
Nederlands | nd | LocalizedResources.nd.json |
Português | pt | LocalizedResources.pt.json |
Browsers generate these based on the browser/system language, this can be configured within the browser:
If the highest priority language doesn't exist, because you don't have a LocalizedResources file for it, the site will display in the next available language and cascade down.
For example, if the user sends a request for en-GB,en;q=0.9,fr;q=0.8,de;q=0.7
the following files would be merged from highest to lowest priority:
However, if only the following files existed:
Then the site would display to the user in French as that is the highest priority language available.
This is an unlikely scenario as not that many users have multiple languages declared in their browser and will likely only occur for English users.
To ensure this doesn't occur, copy System\LocalizedResources.json
to Custom\LocalizedResources.en.json
You can use the Current Client Language Special Variable to get a list of the current client languages.
The result of this can be used in rules to have your projects translated base don the user's language.