Skip to content

@s-ui/i18n: Allow monitorize missing translation keys #1731

@oriolpuig

Description

@oriolpuig

Package

@s-ui/i18n@1

Description

A long time ago, we decided to create the @s-ui/i18n package by forking the node-polyglot npm library instead of wrapping it and getting the new library updates more easily than now. During this time, we have been iterating @s-ui/i18n with some little customizations that now make it more difficult to update the version with the new node-polyglot one.

One of the useful things the node-polyglot library has and we have not, is to allow @s-ui/i18n consumers to use observability tools to track which translation key does not have a translation and find translation issues on the fly. Our library only writes a console.warn to logo it into the client console browser.

Steps to Reproduce

  1. Open your desired browser
  2. Open the browser console
  3. Go to a Fotocasa Ad detail
  4. Filter the console logs by Missing and you will se something like the image bellow
image

Expected behavior: Allow @s-ui/i18n consumers to track when a translation key is missing. We have 3️⃣ approaches:

  • 1️⃣ When onMissingKey callback is configured, prevent writing the console.warn, as is on node-polyglot at this line
  • 2️⃣ Send the onMissingKey and write the console.warn at the same time.
  • 3️⃣ Send the onMissingKey (in case of been configured) and add a flag logMissingKey to prevent writing the console.warn.

Warning

🙏🏻 Please, let me know which approach you like: 1️⃣ , 2️⃣ or 3️⃣ .

Current behavior: When a translation key is missing, a console.warn appears in the browser console.

Additional Information

We can disable the console.warn to avoid printing those warnings on the browser console, but in my opinion is better to empower teams to track and detect the translation issues.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions