Search code examples
elixirgettext

How do I handle fuzzy lines in elixir gettext po files?


I'm fixing spelling and grammar errors in my Elixir project's output strings. I haven't worked with gettext before (other than making strings.)

When I run mix gettext.extract and then mix gettext.merge priv/gettext the first po file I examined has kept the old spelling mistake and added the correction at the bottom with the comment line:

#, elixir-format, fuzzy

Do I resolve this manually by deleting the old version of the string? What do I do with the comment on the corrected line? Should I delete the old string from the pot file manually? (That seems to make the process of fixing these mistakes really annoying. I would expect the old unused strings to go away.) With two lines in the file for the original string will the application use the correct translated string if there are two versions for the same line? Some of the msgids have the comment line about elixir-format, what is it doing for me?


Solution

  • If a translation is automatically extracted (i.e. they have a #: before the msgid), then they will be automatically removed when we can no longer find an equivalent. This applies to both extract and merge commands. So if you rely on extract + merge and you don't change the .pot files manually, then it will always be handled for you.

    The "fuzzy" bit can be safely removed, it is there only to show you that the original msgid changed and we "guessed" the translation based on the previous msgid.

    The elixir-format bit is used by gettext editors, so they know which kind of syntax they should use for interpolation and the like.