About Userlane Language Detection
Userlane automatically detects the language of your application and of the user's browser to match a user's language preferences.
Language Detection Priorities
Userlane detects languages based on a priority list. You can find that below:
Priority 1: Language is taken from the settings of the application (lang Command)
Priority 2: Language is taken based on your language settings in the Userlane Portal
Priority 3: Based on the HTML tag
Priority 4: Based on Meta information
Priority 5: Based on the browser language
Priority 6: The language falls back to the default language defined in the Userlane Portal
ℹ️ In case the application has the language tag hard-coded in the app’s HTML, please contact your Customer Success Manager. As in those cases, we can adjust the language detection from our side, which will prioritize the end user’s browser language over the application's language.
Defining a specific Language
If you want to make sure that Userlane always uses the same language as your application, you can explicitly define the language that Userlane should use with the language command.
This is especially useful if your application offers a language setting and does not define its language in the standard html lang-Attribute:
// set the language of userlane
Userlane('lang', 'language_code');
Your language_code might be a 2 letters code (like 'en' or 'de') or a 5 letters code (like 'en-us' or 'en-gb').
Best Practices
The language code used in the command should exactly match the language key that was used when the language was created in the Portal.
Keep in mind, that the language you pass via the language command must exist and be public in the Userlane Portal. Otherwise, Userlane will take the defined default language instead.