I am using just the classic universal login experience and I have english and japanese activated in the tenant settings. How do I make it so the login page is automatically translated based on the users location?
Additionally, I would also like to translate the signUpTerms that I have added.
I have found no guide on this.
Hi @benjamin203
The documentation for internationalising Classic Universal Login is here https://auth0.com/docs/customize/internationalization-and-localization/lock-internationalization
Essentially all you need to do it set your language as part of the options that get initialised with Lock e.g for Spanish:
// Select a supported language
var options = {
language: 'es'
};
// Initiating our Auth0Lock
var lock = new Auth0Lock(
'{yourClientId}',
'{yourDomain}',
options
);
To get the browser language you might something like:
...
language: navigator.language,
...
Look out for the supported language types as documented here: https://auth0.com/docs/customize/internationalization-and-localization/lock-internationalization#provided-languages
For Spanish for example, the browser may return es-ES and may not get a match with our supported language type in which case may need to to do some mapping e.g:
if (navigator.language === "es-ES") {
language= "es"
}
else {
language = navigator.language
}
Hopefully you’ll be able to get this to work for you.
Warm regards.
@SaqibHussain Can I list multiple languages?
for example:
var options = {
language: ‘es, de, ja’
};
@SaqibHussain
How do I translate the signUpTerms?
Hi @benjamin203
The documentation does not suggest you can pass in multiple languages so I wouldn’t have thought so.
To translate the signUpTerms I believe you would need to provide the translations yourself. You could for example specify your own languageBaseUrl to point to a set of dictionaries that you host, which you can customise fully for each language you wish to support and provide translations for whatever you need.
Warm regards.