scelis / twine

Twine is a command line tool for managing your strings and their translations.
Other
840 stars 151 forks source link

Exporting/Importing iOS to PO(gettext) uses strings as id's #218

Closed stevenb9 closed 5 years ago

stevenb9 commented 7 years ago

I' m currently using twine 0.10.1 and when exporting iOS translations to PO files, the exported PO files seem to use the string for id. When importing the translated files twine will warn "Warning: 'Terms & Conditions' not found in twine file." for each entry and no translated strings gets updated in the twine data file.

The content of my PO file: msgctxt "initial_masterpinTitle" msgid "Create a master pincode" msgstr "Create a master pincode"

msgctxt "initial_masterpinHelp" msgid "This pincode is required to view \n age-rated content" msgstr "This pincode is required to view \n age-rated content"

msgctxt "initial_masterpinReEnter" msgid "initial_masterpinReEnter" msgstr "Re-enter master pincode"

Expected: msgctxt "initial_masterpinTitle" msgid "initial_masterpinTitle" msgstr "Create a master pincode"

msgctxt "initial_masterpinHelp" msgid "initial_masterpinHelp" msgstr "This pincode is required to view \n age-rated content"

msgctxt "initial_masterpinReEnter" msgid "initial_masterpinReEnter" msgstr "Re-enter master pincode"

When importing, the keys from the po file don't match the existing keys in the twine.txt datafile. This seems to work when exporting as apple .strings

scelis commented 7 years ago

This was a decision made by @keverets in 5c63f8d1c17d5296d5e3f5123f44b8effa732ca4

    Add Gettext formatter to read and write to .po files

    This uses the same style as android2po where msgctxt is used as the
    key, msgid is the original string in the default language, and msgstr
    is the translated version in the destination language.

Does this not seem right to you? Digging through some of the gettext documentation does not make the correct solution seem obvious.

scelis commented 7 years ago

Also, this is all somewhat related to #201

For a while if you didn't specify format explicitly, then an undefined one was used for po files (either Django or gettext). I notice that your consume-all-localization-files command above did not specify gettext, so it's possible that it tried to consume them using the django formatter.

scelis commented 5 years ago

Closing due to inactivity. Unclear whether or not there is actually a bug here.