gettext icon indicating copy to clipboard operation
gettext copied to clipboard

Save previous message for fuzzy matches

Open maennchen opened this issue 3 years ago • 3 comments

Should this be the default behavior or hidden behind a flag?

maennchen avatar Jul 20 '22 21:07 maennchen

How does it affect what gets written to the PO files?

whatyouhide avatar Jul 30 '22 12:07 whatyouhide

@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: https://github.com/elixir-gettext/expo/blob/d3b6377edf24884f290efcaae1f5e346c39e3555/test/expo/po_test.exs#L500

maennchen avatar Jul 30 '22 14:07 maennchen

@whatyouhide It would probably make sense to handle this the same as #315

maennchen avatar Aug 02 '22 07:08 maennchen

@whatyouhide Do you have an update so that I can finish the PR?

maennchen avatar Oct 03 '22 13:10 maennchen

@maennchen sorry for the long wait. I agree, having this behind an option (like :on_obsolete) sounds great. By the way, #| is the "official" GNU Gettext comment for old fuzzy matches, right?

whatyouhide avatar Dec 17 '22 09:12 whatyouhide

@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.

maennchen avatar Dec 17 '22 15:12 maennchen

Yeah I’m down for that 👍 My question was: do "previous translations" have an official comment in GNU Gettext?

whatyouhide avatar Dec 17 '22 16:12 whatyouhide

@whatyouhide Yes, the #| syntax is official.

See: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html

white-space
#  translator-comments
#. extracted-comments
#: reference…
#, flag…
#| msgid previous-untranslated-string
msgid untranslated-string
msgstr translated-string

[...]

The previous-untranslated-string is optionally inserted by the msgmerge program, at the same time when it marks a message fuzzy. It helps the translator to see which changes were done by the developers on the untranslated-string.

maennchen avatar Dec 17 '22 16:12 maennchen

Ah that's fantastic. Let's go for the option then, and we'll be good to go here.

whatyouhide avatar Dec 17 '22 18:12 whatyouhide

@whatyouhide I'll add that in next week :+1:

maennchen avatar Dec 17 '22 19:12 maennchen

Pull Request Test Coverage Report for Build f9f5149cf47d6c99001d57308041fe7f890040c6-PR-316

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 89.61%

Totals Coverage Status
Change from base Build b720495c9700bfcf87fd149e1e796502ba75f858: 0.07%
Covered Lines: 552
Relevant Lines: 616

💛 - Coveralls

coveralls avatar Dec 19 '22 13:12 coveralls

Awesome work, thanks @maennchen! 💟

whatyouhide avatar Dec 20 '22 11:12 whatyouhide