Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2007-10-24 05:31:46


Jens Seidel wrote:

> On Wed, Oct 24, 2007 at 11:12:28AM +0400, Vladimir Prus wrote:
>> Pavel Syomin wrote:
>> > I am writing some application that uses program_options. This
>> > application interacts with user using non-english language. Is there
>> > any way to translate "what" messages from exceptions to another
>> > language? At now I found only one way (rather hack :) ):
>>
>> No, sorry.
>>
>> The classic solution would be to wrap all english texts with "i18n", and
>> then use gettext or similar to extract such strings, prepare translations
>> and then use it. But, this requires changing Boost build process to
>> actually run gettext. I suspect somebody will surely object, since
>> gettext is not portable ;-)
>
> But a gettext approach uses nearly always macros such as _("") and
> N_(""). If Boost would at least mark all translatable texts using _() or
> N_() a user who wishs i18n support could define these macros (e.g. by
> including first a new boost/i18n.h file) and have messages translatable.
>
> Of course this would also require that xgettext scans not only users
> source code but also Boost's one

Yes, that's the apparent problem.

> but Boost could at least provide PO
> files containing translations so that users can merge these with own
> files.

That's what I have in mind. It's not particularly hard, either,
since Boost.Build has support for gettext already. The question is
whether the will be objections to using tool that is mostly
only available on Linux. And, the model of _("") is somewhat
specific to Linux, I think on windows one has to make integer
ids.

> Since most Boost libraries are header only, it makes no sense to ship
> binary .mo files and the user has to care about Boost's message
> translation himself.

Well, before .mo file you need to have translated .po. Clearly,
translated .po would be of value.
Actually, .mo might be of use, too, assuming _("") expands to

        dgettext("boost", ...)

as opposed to

        gettext(...)

which is a good idea anyway. Of course, the main application
will be responsible for install .mo files and hooking them in.
And given that, .mo is indeed little advantage over translated
.po.

- Volodya


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net