-
Notifications
You must be signed in to change notification settings - Fork 84
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
Retain custom flags during merge #369
Labels
Comments
@johantell yes, the |
Sure thing, |
@johantell awesome. PR is definitely appreciated!! 💟 |
johantell
added a commit
to johantell/gettext
that referenced
this issue
Jul 31, 2023
Background: While merging translations with `mix gettext.merge` flags get cleared out and replaced with the exception of `fuzzy`, which is kept. This change will allow the `custom_flags_to_keep` flag to add a list of flags to be kept in addition to `fuzzy` which helps prevent information loss if external tools adds their own flags to messages. Fixes elixir-gettext#369
whatyouhide
pushed a commit
that referenced
this issue
Jul 31, 2023
Co-authored-by: Andrea Leopardi <an.leopardi@gmail.com> Closes #369. While merging translations with "mix gettext.merge", flags get cleared out and replaced with the exception of "fuzzy", which is kept. This change will allow the ":custom_flags_to_keep" option to add a list of flags to be kept in addition to "fuzzy" which helps prevent information loss if external tools adds their own flags to messages.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background:
In our project, we've implemented an auto-translate feature that helps team members translate to languages they don't know (and we'll help adjust them through the review process or send them over to someone who helps us with the translation).
We've set up a mix task that back-fills all empty translations in a specific language with translations from an external language model and adds the
auto-translated
tag to the message.We've noticed recently that all those tags get removed when doing a
mix gettext.extract --merge
, which causes some disruption for us as we use those tags to know which messages we should send to our external human translators for verification.Problem
From my understanding (by looking through the
Merger
module),fuzzy
is the only flag allowed to be retained over multiple merges (https://github.com/elixir-gettext/gettext/blob/main/lib/gettext/merger.ex#L230-L236), which is why we're experiencing our problemSuggested solution
I understand that there is most likely a very sound reason to resetting the tags on each extraction so my suggestion is that we make the retained titles configurable through our mix-file:
Where we either use
["fuzzy"]
as a default or merge the "internal" flags with the configured valueIf this suggestion sounds good to you, I'd be happy to implement it and shoot a PR your way :)
The text was updated successfully, but these errors were encountered: