delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2012/03/17/23:15:16

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Rugxulo <rugxulo AT gmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GNU gettext
Date: Sat, 17 Mar 2012 19:38:26 -0700 (PDT)
Organization: http://groups.google.com
Lines: 64
Message-ID: <6fdeb7da-2a1b-4d4c-8e53-e0989940b5a3@t16g2000yqt.googlegroups.com>
References: <bba88497-fdf0-4276-b6fa-7e34e4bc11cd AT d17g2000vba DOT googlegroups DOT com>
<83obrv2sz6 DOT fsf AT gnu DOT org>
NNTP-Posting-Host: 65.13.115.246
Mime-Version: 1.0
X-Trace: posting.google.com 1332039870 25911 127.0.0.1 (18 Mar 2012 03:04:30 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Sun, 18 Mar 2012 03:04:30 +0000 (UTC)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: t16g2000yqt.googlegroups.com; posting-host=65.13.115.246; posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.16
(KHTML, like Gecko) Chrome/10.0.630.0 Safari/534.16,gzip(gfe)
Bytes: 3754
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q2I3F1BA006611
Reply-To: djgpp AT delorie DOT com

Hi,

On Mar 17, 9:38 am, Eli Zaretskii <e DOT  DOT  DOT  AT gnu DOT org> wrote:
> > From: Georg <dos DOT  DOT  DOT  AT googlemail DOT com>
> > Date: Sat, 17 Mar 2012 03:48:00 -0700 (PDT)
>
> > I am porting a program from Linux to DOS. This then uses my FLTK for
> > DOS port which allows to display UTF8 characters using an ISO10646
> > truetype font.
>
> > The linux program uses "gettext" to allow to display the menu items in
> > different languages. There is a "po" directory with files for these
> > different languages.
>
> > In "main.cpp" there are the following commands:
>
> > // GNU gettext initialization
> > setlocale(LC_MESSAGES, "");
> > bindtextdomain(PACKAGE, LOCALEDIR);
> > textdomain(PACKAGE);
>
> > Within the other program files which define the menus there is
> > defined:
>
> > #define _(String) gettext((String))
>
> > this refers to e.g. this command:
> > fl_alert(_("Cannot open file..."));
>
> > DJGPP/libintl compiles the programs fine but I am not sure what it
> > actually does when executing the commands mentioned above.
>
> It calls the `gettext' function (through the _ macro), which looks up
> the string "Cannot open file..." in the message catalog for the
> current language, and returns its translation.  So fl_alert will
> display the translated message.
>
> > Can I use the DJGPP version of "gettext" in my situation and if yes,
> > how?
>
> It depends on how you did the font stuff.  gettext assumes that if you
> send an iso8859-1 code to the screen, the corresponding iso8859-1
> character is displayed (and the same with any other character set).
>
> > If I get "gettext" to work, can it be used with a command line option
> > or a menu in the program to allow to select the desired language?
>
> You will need to call setlocale and bindtextdomain based on those
> options, then it should work.

Does DJGPP libc even support anything other than the minimal C / POSIX
locale? Won't setlocale() just fail on anything else??

I don't know, perhaps I'm wrong, or perhaps it doesn't matter here,
but I didn't think it had very much (if any) support for that. You may
have to hack at it and force a hardcoded dir path to find such font
files.

I did very very briefly play with liblocale (
http://na.mirror.garr.it/mirrors/djgpp/current/v2tk/llocl02s.zip ) a
few months ago, and it worked slightly better than default, but it's
still not perfect (i.e. only for "2.03p2 stable", not 2.04 beta).
Perhaps you can adapt it, but this may be beyond the call of duty,
even for DJGPP.   :-(

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019