help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Windows Internationalization


From: Luca Marzolla
Subject: Re: Windows Internationalization
Date: Wed, 15 Oct 2008 22:43:36 +0200
User-agent: Thunderbird 2.0.0.17 (Windows/20080914)

Tim Van Holder ha scritto:
Luca wrote:
Hello!

I have written a compiler for a pascal-like language, using flex and bison. The compiler is built under Windows using Visual Studio and works very well, however how can I provide an internationalization? I need to translate syntax error messages generated by bison's parser in another language, different from English.

Thanx in advance.

As part of the bison package, there is a "bison-runtime" gettext domain.
This provides the messages shown by bison-generated code at runtime.
If
 a) you provide a version of this catalog for the language you need, and
 b) you include the gettext library in your application the "normal"
    way, and
 b) set the LANGUAGE environment variable to that language (e.g. "it"
    for Italian) before running your executable
then your compiler should automatically use those translations. This requires that the bison-runtime catalogs be installed (they would be as part of a bison installation, but I'm not quite sure how to set up your own configury to include & distribute them). Ideally, you would then also set up a message catalog for all other messages you yourself produce in your compiler. Note that I don't think flex 2.5.4a or earlier provided i18n for its runtime messages; the newer versions might.

For a list of languages already supported by bison-runtime, see here:
  http://translationproject.org/domain/bison-runtime.html
If you want to improve upon translations, or provide a new one for a language not already supported, see
  http://translationproject.org/html/translators.html
for how to join a translation team and start translating.


_______________________________________________
address@hidden http://lists.gnu.org/mailman/listinfo/help-bison

Thank you for your reply, only in the last days I could try what you suggested.
I get a translated string, with the following calls

   setlocale(LC_ALL,"");
   bindtextdomain("bison-runtime","C:\\cygwin\\usr\\share\\locale");

but I still have some problems.

  1. The args in the string are wrong "errore di sintassi, atteso %2$s
     o %3$s e non %1$s". This is really tricky, "%1$s" isn't a right arg.
  2. I cant debug the parser, because when I set yydebug to a
     nonzerovalue I got a crash in YYDPRINTF macro.
  3. How to set a different language? setlocale(LC_ALL,"de"); seems to
     have no effect, messages still remain in Italian.

Take in account I'm using visual studio and I specified a different token name (%token ID "IDENTIFIER"), moreover the compiler is inside a DLL.

Thanks once again for your help.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]