gettext

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.

See:
http://overshoot.tv/wiki/tools/translation_tools#Gettext

Troubleshooting

msgmerge: invalid multibyte sequence

Example with a file containing Chinese:

msgmerge --update translations/tw/overshoot_smoking.po   translations/overshoot_smoking.pot
translations/tw/overshoot_smoking.po:3: invalid multibyte sequence
translations/tw/overshoot_smoking.po:3: invalid multibyte sequence
translations/tw/overshoot_smoking.po:3: invalid multibyte sequence
translations/tw/overshoot_smoking.po:3: invalid multibyte sequence
translations/tw/overshoot_smoking.po:3: invalid multibyte sequence

Solved by adding "Content-Type: text/plain; charset=UTF-8\n" within the header of the .po file (i.e. the file containing the Chinese translation).

Full header example:

msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: augustin <augustin@example.com>\n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

More on .po file headers:
http://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html#H...

gettext does not translate new strings

You have added some new strings to your software. Then you have merged the new strings to your .po files and translated them. But when you run the software, the newly translated strings are not taken into consideration.

Solution: remember to compile the .po file with msgfmt, e.g.:

msgfmt -o LC_MESSAGES/overshoot_smoking.mo overshoot_smoking.po