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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS Lexer does not recognize keys in the options passed to t func #779

Open
rikmarais opened this issue Feb 17, 2023 · 2 comments 路 May be fixed by #994
Open

JS Lexer does not recognize keys in the options passed to t func #779

rikmarais opened this issue Feb 17, 2023 · 2 comments 路 May be fixed by #994

Comments

@rikmarais
Copy link

馃悰 Bug Report

When using the built-in Javascript Lexer, t wrapped keys in the options that are passed to the t function are ignored and not parsed.
E.g. t('foo {{ target }}', { target: t('bar') })

  • foo {{ target }} is extracted
  • bar is not`

To Reproduce

Run i18next-parser with the base JS lexer on any .js file containing the following line:

 // t('foo {{ target }}', { target: t('bar') })

Expected behavior

Translated keys within the options passed to already extracted keys should be caught as well.

{ 
 "foo {{ target }}": "foo {{ target }}",
 "bar": "bar"
} 

Your Environment

  • runtime version: node v14 and node v18
  • i18next-parser: 7.0.0
  • i18next: 21.5.2
  • os: Windows

Apologies if this has been reported before. We'd like to avoid extra comments and lines if possible and the included JS lexer does not appear to catch the below case. Assistance or a reference to what is considered best practices in this situation would be appreciated.

@elboletaire
Copy link

I've recently reproduced this with latest parser version (8.3.0).

@LunaInsidious
Copy link

I think I can solve this issue, so I will create a PR.

@LunaInsidious LunaInsidious linked a pull request Apr 4, 2024 that will close this issue
2 tasks
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.

3 participants