How to set the template language to 'pt-PT'?

I set the language in my frontend app like this:

webAuth.popup.authorize({
  ui_locales: 'pt-PT', // other values I pass here include: fr, it, de, en, pt-BR ...etc
  //additional options can go here
}, function(err, authResult) {
  //
});

In the email template I read the language code like this:

{% assign language = user.user_metadata.lang %}

{% if language == 'pt-BR' %}
Olá
{% elsif language == 'de' %}
Hallo
{% elsif language == 'es' %}
Hola
{% elsif language == 'fi' %}
Hei
{% elsif language == 'fr' %}
Bonjour
{% elsif language == 'it' %}
Ciao
{% elsif language == 'pt-PT' %}
Olá
{% elsif language == 'ru' %}
Привет
{% elsif language == 'sv' %}
Hej
{% else %}
Hi

All language codes work perfectly fine (including pt-BR) the only language that doesn’t work and default to ‘en’ (user.user_metadata.lang returns ‘en’) is ‘pt-PT’.

I tried to pass in different variations like (pt, pt-pt, pt-PT). However, it all defaults to ‘en’.

Hi @seif.elmughrabi,

Welcome to the Auth0 Community!

I understand you’ve had issues setting the pt-PT language in your email template.

To better understand the scenario, could you please clarify which email template you are having issues? Is it the Welcome Email template? I’d like to see if I can reproduce the issue.

From what I have found, the pt language tag is the option for selecting the Portuguese language according to our Lock Internationalization documentation.

I’m looking forward to your reply.

Thank you.

1 Like

Thank you @rueben.tiow

Yes, it’s the Welcome Email template.

I just tried again with ‘pt’ and it defaults to English.

This is how I set the language in the frontend app:

This is how I retrieve it from the Welcome Email template:
image

Also, I just saw that the exact same issue happens with ‘zh’ language.

After doing bit more checking, I can confirm these codes work fine for Portuguese and Chinese:

pt-PT
zh-CN
1 Like

Hi @seif.elmughrabi,

Thank you for your responses and for sharing your findings that the Portuguese and Chinese languages are working correctly!

Please let me know if you have any further questions. I’d be happy to help.

Thank you.