-
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
Save previous message for fuzzy matches #316
Conversation
How does it affect what gets written to the PO files? |
@whatyouhide When we fuzzy match on a message, the new message is in the msgid and the old one will be stored as a previous message. It will look something like this: |
@whatyouhide It would probably make sense to handle this the same as #315 |
97e0fd8
to
7a393d6
Compare
@whatyouhide Do you have an update so that I can finish the PR? |
@maennchen sorry for the long wait. I agree, having this behind an option (like |
@whatyouhide I‘ll do that 👍 No, the official way fur fuzzy is the fuzzy flag. The pipe comment signals the previous mesage. If I extrat the string Hello World and change it to Hello Worlds, we identify it as fuzzy. We no longer have the initial extracted string though. With bigger translations, it can be helpful for the translator to know how the message changed so that he can apply the same change to the current translation. |
Yeah I’m down for that 👍 My question was: do "previous translations" have an official comment in GNU Gettext? |
@whatyouhide Yes, the See: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html
|
Ah that's fantastic. Let's go for the option then, and we'll be good to go here. |
@whatyouhide I'll add that in next week 👍 |
7a393d6
to
7f07414
Compare
lib/gettext.ex
Outdated
@@ -606,6 +606,11 @@ defmodule Gettext do | |||
If `:mark_as_obsolete`, messages are kept and marked as obsolete. | |||
If `:delete`, obsolete messages are deleted. Defaults to `:delete`. | |||
|
|||
* `:on_fuzzy_match` - controls what happens when fuzzy messages matches are found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whatyouhide I'm not happy with the naming of this option. Do you have a better idea than this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maennchen since the behaviours here are not complementary, but rather one a subset of the other, I think we can have store_previous_message_on_fuzzy_match: boolean()
. The option name is quite long, but I like that it really conveys what it's doing. Regardless of whether the option is true or false, we'll still override the message and mark it as fuzzy, so the option only controls whether we store the old message too. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whatyouhide I agree that a longer more descriptive name is the way to go. I'll adapt accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whatyouhide Done, better?
7f07414
to
d56de24
Compare
Pull Request Test Coverage Report for Build f9f5149cf47d6c99001d57308041fe7f890040c6-PR-316
💛 - Coveralls |
d56de24
to
f9f5149
Compare
Awesome work, thanks @maennchen! 💟 |
Should this be the default behavior or hidden behind a flag?