4

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
    
    
    gettext.bindtextdomain("xxx","/usr/share/locale")
    gettext.textdomain("xxx")
    tr = gettext.translation("xxx",
                             "/usr/share/locale",
                             ["tr_CY"],
                             fallback=True)
    
    
    print tr.gettext("sample")
    

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

What am I doing wrong?

1
  • 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 . Nov 6, 2010 at 21:56

1 Answer 1

3

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 OUTPUT.mo LANG.po

  • -c checks the po file format,
  • -v is for detailed output,
  • -o OUTPUT.mo specifies the output file, where OUTPUT should be the name you used in 'bindtextdomain' and 'textdomain',
  • LANG.po the translation file.
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .