I need some help with gettext

The place for chatting and discussing subjects unrelated to Wesnoth.

Moderator: Forum Moderators

Post Reply
User avatar
GunChleoc
Translator
Posts: 506
Joined: September 28th, 2012, 7:35 am
Contact:

I need some help with gettext

Post by GunChleoc »

Since somebody here managed to split the game into multiple text domains, maybe you can help me with a problem that I have already googled to death with no avail. :augh:

I know this is not a coding support forum, but I don't know where else to ask anymore. Any hints before I completely tear my hair out will be appreciated :D

Problem summary:
  • generate separate pot-files for more than one textdomain and place them in subdirectories below po (e.g. po/gcompris-gui)
  • convince make install to copy the mo files to LC_MESSAGES in a way that's distribution safe
What I'm trying to do:

I have recently gotten involved with a project where the po file has grown to a size that is daunting for new localizers. So, I want to chop it down into smaller units. I read up on the gettext documentation and happily marked all my strings, only to find out there are no tools to generate the pot files if you wish to use more than one textdomain. I will keep all the xml and desktop file stuff in my default textdomain, so I can continue to use intltool for those. I need a solution for C and Python.


What I've done so far:

So, after a couple of days' searching, I found this solution: http://stackoverflow.com/questions/1587 ... n-po-files

In Python, my code looks like this:

Code: Select all

def _gui(text):
        gettext.dgettext(gcompris.GETTEXT_GUI,text)

    test1 = _gui("Test1")
    test2 = _("Test2")
And then I call

Code: Select all

xgettext --keyword=_gui -d gcompris-gui -o gcompris-gui.pot -p ../po/gcompris-gui --package-name=GCompris-GUI -D hangman-activity/hangman.py
  • intltool-update now ignores test1 as it should, but xgettext picks up both strings in spite of the keyword specification.
  • I have no problem generating the po-files for each language and compiling the mo-files, but then I'm completely stumped as to how to add them to the make stuff so that they will get installed to LC_MESSAGES
Post Reply