-
Notifications
You must be signed in to change notification settings - Fork 35
Description
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
- Open your desired browser
- Open the browser console
- Go to a Fotocasa Ad detail
- Filter the console logs by
Missingand you will se something like the image bellow
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 onnode-polyglotat this line - 2️⃣ Send the onMissingKey and write the
console.warnat the same time. - 3️⃣ Send the onMissingKey (in case of been configured) and add a flag
logMissingKeyto prevent writing theconsole.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.