[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gettext] xgettext and messages from database

From: Daiki Ueno
Subject: Re: [bug-gettext] xgettext and messages from database
Date: Wed, 22 Jul 2015 08:02:53 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Aljosha Papsch <address@hidden> writes:

> The remaining pieces are messages from a MySQL database and for that I
> would like to know your opinion about the best approach. On the web is
> an example[1] which writes translatable messages directly to a .po
> file.

Actually, the example does not seem to produce a .po file, but a .pot
file, which can be used as an input of xgettext.  That sounds a
reasonable solution, since neither YAML nor JSON has a standard
mechanism to mark strings translatable.

> That's certainly doable for me, though surely it's better to let
> xgettext be the sole creator of .po files instead of a home brew
> solution? Instead, I could imagine writing to a JSON file that simply
> lists the messages like this:
> [
>   "Greece",
>   "Nice and sunny",
>   "Spain",
>   "Just as nice and sunny"
> ]
> This file can be consumed by xgettext because JSON is a subset of
> JavaScript.

If you simply extract all strings in a JSON file, it is possible with
xgettext -L JavaScript -a.  However, if you want to extract certain
strings from a JSON file, I'd suggest to use an intermediate .pot file
as above, using something like JSONPath.

Daiki Ueno

reply via email to

[Prev in Thread] Current Thread [Next in Thread]