Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodes i18n The translation matcher could include __ #30

Closed
bleuscyther opened this issue Nov 26, 2022 · 2 comments · Fixed by #31
Closed

Nodes i18n The translation matcher could include __ #30

bleuscyther opened this issue Nov 26, 2022 · 2 comments · Fixed by #31

Comments

@bleuscyther
Copy link
Contributor

While using the popular i18n library, I discovered that I needed to specify __ in the regex.

/(?:[$ .](__))\(.*?\)/gi

Or more generally

const defaultValues = {
// ...
 translationKeyMatcher: : /(?:[$ .](_|t|tc|i18nKey|__))\(.*?\)/gi,

// ...
};

I am leaving this here for others in the future or if people are having issues with other translation libraries.


i18n-unused
is a must-have if you are doing internationalization with JS. Imprecive work mxmvshnvsk

@bleuscyther
Copy link
Contributor Author

translation-key-matcher is not in the supported list of options for the Shell commands.
Overriding the config would look like this:

i18n-unused display-unused --locales-path src/locales --src-path src/ --translation-key-matcher '/(?:[$ .](_|t|tc|i18nKey|__))\(.*?\)/gi'

@bleuscyther
Copy link
Contributor Author

Another suggestion, I am using ESM so the i18n-unused.config.js is not found, the module parser is expecting i18n-unused.config.cjs.
I think the config package should be allowed to be:

  • json
  • js
  • cjs (ESM modules parsing CommonJS )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant