Introduction

Internationalization (i18n) in LWCs is the process used to adapt an LWC to various languages and regions without duplicating code.

<aside> 💡 If you are not familiar with Internationalization (i18n) in LWC, review this section:

i18N - Internationalization for LWC

</aside>

This is a recap from the previous link, In LWC, this involves several key steps:

  1. User Locale Information:
  2. Custom Labels:

Best Practices & my recommendations

By following these guidelines, you can create LWC applications that are easily adaptable to different languages and regions, providing a better user experience for a global audience.

LWC example

This LWC tries to showcase the basic capabilities that allow to present data on the user’s locale. Also, it is included how to use a custom locale, so both are compared.

<aside> 💡 If you are a Japanese user, please change the value for this variable anotherLocale = "ja-JP” to another different locale like anotherLocale = "es-ES” or any other so you can see the difference.

</aside>

<aside> 📂 This LWC is not available in the LWC Recipes Github repository, but in this reposiroty instead: https://github.com/egraells/lwc-recipes-ege/tree/main/force-app/main/default/lwc/egei18n

</aside>

Meta configuration file