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

Add support in detective for including "Extra Keys" with --add-missing-keys #108

Open
micaminoff opened this issue Sep 7, 2021 · 0 comments

Comments

@micaminoff
Copy link

micaminoff commented Sep 7, 2021

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

I'm changing the i18n implementation of a fairly large app and transloco has been great so far. I only have a slight issue with translation generation for dynamic keys.

The number of dynamic translations required is pretty big, and adding explicit comments with every key to the templates is rough. However, one of my translation files already has a bunch of the missing keys missing from other files.

e.g.

File Name Missing Keys Extra Keys
en -- static, ok, error, ...
de -- --

Describe the solution you'd like

I'd like to propose another flag --merge-extra-keys (or something) to be used in conjunction with --add-missing-keys. This flag would cause the detective to add the so-called "extra keys" to i18n files where they are missing.

Alternatively we could have an --add-extra-keys flag to use instead of the two above together.

Before:

File Name Missing Keys Extra Keys
en -- static, ok, error, ...
de -- --

After:

File Name Missing Keys Extra Keys
en -- static, ok, error, ...
de -- static, ok, error, ...

Describe alternatives you've considered

A small script to identify keys present in one file and missing in another one and updating the lacking file is pretty trivial, but I'd rather the library itself supported this.

Current behavior

"Extra" keys present in one file aren't added to one that doesn't have them.

Expected behavior

When using --add-missing-keys and also --merge-extra-keys "extra" keys should be added to files where they don't exist

Additional context

Copy-pasting is boring

Contribution

I want to make a pull request for this feature:
[ ] Yes! 🚀
[X] Maybe next time

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

1 participant