Best way to implement localization/internationalization in auth0?

I am using custom ui instead of lock and for that I want to implement language support for all countries. SO what is the best way to implement that?

I don’t know of a way to get Auth0 to do that for you server side, but there are a few ways to do it client side. Just a couple of random ideas:

  • Get window.navigator.language with JavaScript and use that. If you only support select languages, you could compare it to an array of supported languages first and go from there.
  • If your user has already picked a language on your app, you could send that info along as a URL parameter (like lang=nl) and pick that up with JavaScript on your hosted pages.
  • If you want to get real fancy with this, you could do one or both of the above and store the chosen language using localStorage. So on a subsequent visit you could just load the chosen language from localStorage and use that.

Whatever you do, I think it would be a good idea to show a language selector on your hosted pages in case you guess wrong. That’s feels more like a last resort, though. Definitely try to prevent guessing wrong each time and making the user select the right language each time.

Final idea, since you’re using a custom design, is to not use text at all and say everything using icons. Very hard to get that right, though. Just writing the JavaScript might be quicker. :sweat_smile:

Hope that was helpful!