Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am really struggling with this language issue.

I went to System->Administration->Language Support and moved Turkish (Türkçe) to the top. Then I clicked "Apply System-wide" and restarted.

However, after restarting, echo $LANG reported en_US.utf8, so I logged out and back in - and now it reports tr_CY.utf8.

Now here's the problem:

  • I have a file 'xxx.po' in /usr/share/locale/tr_CY/LC_MESSAGES
  • I run the following Python code:

    import gettext
    tr = gettext.translation("xxx",
    print tr.gettext("sample")

Although 'sample' should be translated, it isn't.

What am I doing wrong?

share|improve this question
That tr_CY (means Cypriot Turkish) has nothing to do with even a few hundred thousand Turk living in Cyprus. It should be tr_TR . Maybe after this modification, it works. Even if it works or not after modification, tr_CY is wrong, it should be tr_TR . – marenostrum Nov 6 '10 at 21:56
up vote 3 down vote accepted

I have a file 'xxx.po' in /usr/share/locale/tr_CY/LC_MESSAGES

The files in /usr/share/locale/<LANG>/LC_MESSAGES need to be in a binary format ('.mo' extension).

You achieve that by running msgfmt on the '.po' file:

msgfmt -c -v -o LANG.po

  • -c checks the po file format,
  • -v is for detailed output,
  • -o specifies the output file, where OUTPUT should be the name you used in 'bindtextdomain' and 'textdomain',
  • LANG.po the translation file.
share|improve this answer
Thanks! Worked like a charm! – Nathan Osman Nov 6 '10 at 22:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.