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

I set the language in my frontend app like this:

  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' %}
{% elsif language == 'de' %}
{% elsif language == 'es' %}
{% elsif language == 'fi' %}
{% elsif language == 'fr' %}
{% elsif language == 'it' %}
{% elsif language == 'pt-PT' %}
{% elsif language == 'ru' %}
{% elsif language == 'sv' %}
{% else %}

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:

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:

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.