[aur-dev] Using gettext for translations?
dpmcgee at gmail.com
Wed Apr 6 23:07:15 EDT 2011
On Wed, Apr 6, 2011 at 9:27 PM, Lukas Fleischer
<archlinux at cryptocrack.de> wrote:
> On Wed, Apr 06, 2011 at 10:26:35PM +0200, Lukas Fleischer wrote:
>> I thought about this sometime ago. The existing i8n files shouldn't be
>> too hard to convert and we could move translation work to some more
>> appropriate platform like Transifex which is used by pacman already. PHP
>> gettext integration doesn't seem to be too bad and our PHP is compiled
>> with gettext support by default, also.
>> Any opinions/objections?
> Pushed a first draft to my "wip" branch. There still is a bunch of hacky
> stuff that needs to the reviewed or fixed. This should rather be
> considered as some code to play around with.
> Patches welcome.
Hmm. You're missing like the most important part- how are you
generating the original message catalog? I came up with this, this
should be the very first patch as "make catalog" or something:
$ grep -RFl '__(' web/* | xargs xgettext --default-domain=aur -L php
And then naming this file aur.pot
A much better solution is obviously not to grep, but to put the
filenames in a POTFILES file (pretty standard convention), and then
using the --files-from flag. You can also use the --directory=web flag
to not have to duplicate that in every path specified. Read the
manpage of xgettext for some other things to consider: c-format
strings, whether to include line number comments (I'd encourage
against them as it generates a lot of churn in the files hiding the
Next, I'd recommend setting up some makefile shortcuts for running
msgmerge to update the translation files from the catalog. Then use
this to make another checkin of the language-specific po files so they
are in a more "native" format, with the headers and all that.
* A capital gettext domain seems silly and out of character; I'd
really just think about going with "aur".
* Use --check when calling msgfmt.
More information about the aur-dev