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

Feature Request: generate en.json from fallback text #44

Open
jliebrand opened this issue May 28, 2020 · 2 comments
Open

Feature Request: generate en.json from fallback text #44

jliebrand opened this issue May 28, 2020 · 2 comments

Comments

@jliebrand
Copy link

Perhaps this is already possible? But I'd like to have an en.json to give to translators so they can generate translations. Right now, that means copying the fallback text in to en.json but I dont like the fact the Fallback and en.json could get out of sync.

Is there anyway to generate the en.json from the fallback text? Perhaps by using the eslint plugin somehow?

@jliebrand
Copy link
Author

Also, on a similar note - I'm using the fallback for english and not actually using en.json. The reason is that it would otherwise duplicate the amount of data the client needs to pull down.

The options I see are:

  1. use en.json and no fallback text - but this makes the jsx hard to read
  2. use fallback but no en.json - but this make pluralisation hard/impossible?

What is the recommended route here?

@pl12133
Copy link
Contributor

pl12133 commented Jun 2, 2020

I think the original issue could be accomplished with a codemod that extracts all JSXText nodes inside of Text components out to a json file. That would be handy to have as a separate tool.

As for the issues of best practices with fallback text, I have found that after supporting more than 1 language I avoid using fallback text entirely because it makes it easier to end up with untranslated strings in the JSON language files, as well as the reasons you mentioned.

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

No branches or pull requests

2 participants