On Friday 2004.11.12 20:09:49 +0100, Egmont Koblinger wrote: > On Fri, Nov 12, 2004 at 07:43:16PM +0100, Bruno Haible wrote: > > Hi, > > > gcc-3.4's documentation contains the following: > > > > `-fexec-charset=CHARSET' > > Gee, these are really there in gcc 3.4, but not yet in 3.3. Seems it's time > for an upgrade :-) > > > The portable solution is to use gettext: > > > > printf("%s\n", gettext ("Schoene Gruesse")); > > or printf("%s\n", gettext ("Greetings")); > > Yes, I know... I just wanted a quick solution for a self-hacked utility > which works perfectly both in Latin-2 and in UTF-8 but I didn't want to mess > with additional files and stuff like that... but it seems still gettext is > the easiest way to go.
I have a production-level legacy program that has a moderate level of internationalization but does not use "gettext". The program inspects the locale to see if it is a UTF-8 locale. If it is, the internationalized message strings are used: UTF-8 strings for different languages are isolated in one ".c" file. The program contains code to select the appropriate language strings. If the locale is not a UTF-8 locale, the program falls back to the default POSIX C locale with English-only messages. Well, in my opinion this solution is not as good as using gettext(), but for a legacy program that has to compile and work properly even on platforms that don't support libintl/gettext (like OpenBSD and Cygwin), this was a solution that was easy to implement into the legacy code that originally had no concept of internationalization at all. Of course a major assumption of this solution is that if you do have a modern platform with good internationalization, then you should be using a UTF-8 locale and not some legacy encoding. The documentation for the program makes this very clear. -- Ed Trager > > Thanks very much, > > > Egmont > > -- > Linux-UTF8: i18n of Linux on all levels > Archive: http://mail.nl.linux.org/linux-utf8/ > > > -- Linux-UTF8: i18n of Linux on all levels Archive: http://mail.nl.linux.org/linux-utf8/