On Wed, Apr 06, 2011 at 10:07:15PM -0500, Dan McGee wrote: > On Wed, Apr 6, 2011 at 9:27 PM, Lukas Fleischer > <archli...@cryptocrack.de> wrote: > > On Wed, Apr 06, 2011 at 10:26:35PM +0200, Lukas Fleischer wrote: > >> Hi, > >> > >> 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 > --keyword=__ > > And then naming this file aur.pot
Yes, this was on my TODO. The problem is that __() currently isn't gettext-compatible (it's gettext() plus htmlspecialchars() plus some broken sprintf reimplementation and thus expects more than one parameter in some cases, when there's formatting sequences). I wasn't sure if xgettext(1) could handle that but it seems it does. Thanks. > 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 > actual changes). Yes, sounds good. > 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. Was on my TODO as well. > Patch notes: > * A capital gettext domain seems silly and out of character; I'd > really just think about going with "aur". Ack. > * Use --check when calling msgfmt. Ack.