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.


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

Reply via email to