views:

78

answers:

2

I want to use gettext for i18n. But I need to translate messeges to a different languages. Is it possible to specify a locale for a one gettext call?

A: 

As you can see from http://stackoverflow.com/questions/1537538/replacements-for-gettext I had similar problems, only it gets worse if you have to support more platforms.

Basically gettext is only really suitable for single-threaded interactive programs.

If you have the chance then a different translation system (ICU looks quite nice).

Otherwise there are a few libraries that read .mo files directly, and can provide the translation as you want:

http://art-blog.no-ip.info/cppcms/blog/post/16

Douglas Leeder
A: 

I want to use gettext for i18n. But I need to translate messeges to a different languages.

If your application is single threaded you may switch locale, otherwise you can't use gettext library for this purpose.

Is it possible to specify a locale for a one gettext call?

You may use Unofficial Boost library Boost.Locale that supports gettext message catalogs. But it is C++ only.

Artyom