scelis / twine

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

Twine is generated with wrong languages when created from po files #199

Closed stleye closed 7 years ago

stleye commented 7 years ago

When I create a twine file from a set of po files using the command twine consume-all-localization-files twine.txt poFolder --developer-language en --consume-all --consume-comments, it creates a file where en-GB, fr-CA and zh-Hans languages are renamed, which is a problem when I want to export that twine file to android.

The po files are named as follow ar.po, de.po, en-GB.po, en.po, es.po, fr-CA.po, fr.po, id.po, it.po, ja.po, nl.po, pl.po, pt.po, ru.po, sv.po, tr.po, zh-Hans.po

An excerpt of the twine files as follow [[Uncategorized]] [Let's go mobile!] en = Let's go mobile! ar = لنكن على الجوال! de = Werden Sie mobil! GB = Let's go mobile! es = ¡Pasemos al mundo móvil! CA = Allons-y pour le mobile! fr = Allons-y pour le mobile! id = Ayo beralih ke seluler! it = Vai alla pagina di accesso! ja = モバイルに変更しよう! nl = We gaan mobiel! pl = Weź Avature ze sobą! pt = Vamos virar móvel! ru = Мобильная версия! sv = Låt oss bli mobila! tr = Mobil versiyona geçelim! ns = 登录移动应用!

en-GB -> GB fr-CA -> CA hz-Hans -> ns

sebastianludwig commented 7 years ago

Hey @stleye, thanks for opening an issue :-)

Can you provide an excerpt from your twine.txt?

stleye commented 7 years ago

Hi @sebastianludwig , I renamed the issue and added an excerpt of the twine file, the problem is actually when the twine file is created from the po files.

scelis commented 7 years ago

@stleye That's super helpful. Thanks! I see what the bug is. I'll get a fix up asap.

stleye commented 7 years ago

@scelis Excellent :), there is another small bug I forgot to tell you, if you check the excerpt of the twine file, it uses as key [Let's go mobile!] when the actual key is "go_to_login_page". This is an exceprt of the po file

msgid "" msgstr "" "Language: en\n" "X-Generator: Twine 0.10.1\n"

SECTION: Uncategorized msgctxt "go_to_login_page" msgid "Let's go mobile!" msgstr "Let's go mobile!"

scelis commented 7 years ago

@stleye Oh! I see one of the confusing things that is happening here. Both the gettext and django formatters use .po files but seem to have slightly different formats and requirements. Which are you trying to use? Does the entire process work better for you if you specify the format explicitly using --format gettext or --format django?

stleye commented 7 years ago

@scelis Ah!, I didn't know the --format django option, that one works as expected, thanks!