Hello dear Loïc, > Given the attached messages.pot and messages.po, when calling: > > msgmerge --previous --update messages.po messages.pot > > it produces the attached messages.po.updated file. A diff between messages.po > and messages.po.update shows: > > -#: journalist.py:237 journalist.py:453 > -msgid "Two-factor token failed to verify" > -msgstr "Échec de vérification du jeton de la validation en deux étapes" > +#: journalist.py:237 journalist.py:455 > +#, fuzzy > +#| msgid "Reset Two-Factor Authentication" > +msgid "Could not verify token in two-factor authentication." > +msgstr "Réinitialiser la validation en deux étapes" > > which incorrectly associates "Reset Two-Factor Authentication" as the > previous version of the "Could not verify token in two-factor > authentication." string and therefore swaps the translations. The messages.po > file has the following entry, unmodified in messages.po.updated > > #: journalist_templates/edit_account.html:53 > msgid "Reset Two-Factor Authentication" > msgstr "Réinitialiser la validation en deux étapes" > > The correct behavior would be to keep the original translation. It is always > incorrect to assume two different phrases (in this case "Could not verify > token in two-factor authentication." and "Reset Two-Factor Authentication") > have exactly the same translation.
There are apparently misunderstandings about what msgmerge does and what you can expect from it. 1) The updated messages.po file contains messages marked with "#, fuzzy". These will be ignored by tools that make the translations available to programs (msgfmt and such). The "incorrect associations" between strings that you refer to are therefore void, unless the translator has modified/validated them. 2) The updated messages.po file is meant for review / translation update by the translator. The "#, fuzzy" mark is a hint to the translator, meaning "look here, here is something to do for you". The translator is supposed to modify the translation and then only remove the "#, fuzzy" mark. 3) The effect of the --previous option, namely "#| msgid ...", is to help the translator. In your example, #: journalist.py:107 #, fuzzy #| msgid "You must be an administrator to access that page" msgid "Only administrators can access this page." msgstr "Vous devez être administrateur pour accéder à cette page" the translator may notice that the old and new msgid are semantically the same; this will help her decide what to do about the translation. > The messages.po file has the following entry, unmodified in > messages.po.updated > > #: journalist_templates/edit_account.html:53 > msgid "Reset Two-Factor Authentication" > msgstr "Réinitialiser la validation en deux étapes" > > The correct behavior would be to keep the original translation. msgmerge has kept the original translation: you are saying yourself that this message is unmodified in messages.po.updated. > It is always incorrect to assume two different phrases (in this case > "Could not verify token in two-factor authentication." and > "Reset Two-Factor Authentication") have exactly the same translation. No one is making such an assumption. But it is frequent, when a program evolves, that a message gets duplicated and modified. For example: msgid "The server did not accept your credentials." msgstr "Le serveur n'a pas accepté votre identité." could become, in the next .pot file msgid "The server did not accept your user name." msgstr "" msgid "The server did not accept your password." msgstr "" It *will* help the translator to have the same old translation appear twice among the proposed translations: #, fuzzy msgid "The server did not accept your user name." msgstr "Le serveur n'a pas accepté votre identité." #, fuzzy msgid "The server did not accept your password." msgstr "Le serveur n'a pas accepté votre identité." Finally, if the translator has a feeling that too many fuzzy translations have been produced and that it would be better to leave out these useless translation proposals, she can use option --no-fuzzy-matching. Bruno