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

Support notes to translator #199

Open
wallergoble opened this issue Aug 26, 2021 · 2 comments
Open

Support notes to translator #199

wallergoble opened this issue Aug 26, 2021 · 2 comments

Comments

@wallergoble
Copy link

Is your feature request related to a problem? Please describe.

Hi there 👋 .

We recently moved to using i18next-extract and it's been really helpful. Thank you so much for your work.

One thing our previous solution supported was sending notes to the translator.

Notes in our current codebase look like this:
image

Describe the solution you'd like

We'd like a way to support arbitrary comments associated with a call to the translate function. Ideally we'd like to support multiline comments in some fashion as well.

I see that you have support comments for a variety of things already, e.g.
image

What we'd like to see is something like:

// i18next-extract-translator-comment This describes additional fees for a ticket, e.g. +$3.50 (additional cost)
i18n.t('+%(fee)s (additional cost)'), { fee: '3.50' })

Describe alternatives you've considered

We considered writing a babel plugin that extracts the translator notes as they exist in our codebase and then associates them to the extracted keys provided by the plugin.

Additional context

We're happy to do this work, we just want to solidify on a path forward. Thanks again for maintaining this project.

@gilbsgilbs
Copy link
Owner

Hi, thanks for raising an issue about this. It sounds like an interesting feature. Would you be interested in making a PR? I'd happily merge it.

I have one question though: where would the translator comment go in the output file? I don't see such comment supported in JSONv3 format, but I may be missing something.

@wallergoble
Copy link
Author

Yeah we're happy to do it.

That's actually why we made the issue. We're not sure where to put it either. We were hoping you'd have suggestions. If we can't find a place to put it in the object we could always write a second file.

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

No branches or pull requests

2 participants