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 but Boost could at least provide PO files containing translations so that users can merge these with own files. 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. At least it would be possible ... Jens