caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] error messages in multiple languages ?
Date: Sat, 8 Apr 2017 18:38:02 +0200	[thread overview]
Message-ID: <1715c9d9-04d7-3368-bfbd-3af8aae4698b@inria.fr> (raw)
In-Reply-To: <CABs4TjKhD-3odzvWcMeHEtn7PTpTf-qTENY9xFq0yoBDJDHOYQ@mail.gmail.com>

On 04/08/2017 04:22 PM, Tao Stein wrote:

> I've been teaching OCaml to university students in Beijing. I believe they'd
> feel more comfortable if the error messages were in Chinese. Has anyone
> thought of implementing multi-language strings in the compiler? So, say with
> the setting of an environment variable, the compiler user could receive
> errors and warnings in their preferred language.

Caml Light, the ancestor of OCaml, was internationalized in this manner.  It
had messages in English, French, German, Spanish and Italian.  Curious or
nostalgic minds can have a look at the text file containing the translations:

https://github.com/camllight/camllight/blob/master/sources/src/camlmsgs.txt

and at the i18n engine itself, which was just a wrapper around "printf" that
used the english format message as an index into the translations:

https://github.com/camllight/camllight/blob/master/sources/src/compiler/interntl.ml

This implementation was pretty short and sweet, if I may say so myself, and
possibly easier to use than gettext because by construction the english
message was always available, even if translations were missing by mistake.

Yet it was a lot of work, and quite painful, to keep the message file and
the translations up to date.  Keep in mind that Caml Light had perhaps
1/10th as many messages as OCaml does.  So, the chances of getting i18n to
work for OCaml look thin.  One advantage for me, though, is that it would
make it harder to add new warnings :-)

Your Caml historian,

- Xavier Leroy


  parent reply	other threads:[~2017-04-08 16:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08 14:22 Tao Stein
2017-04-08 14:43 ` Gabriel Scherer
2017-04-08 15:03   ` Sébastien Hinderer
2017-04-08 16:38 ` Xavier Leroy [this message]
2017-04-08 16:51   ` Sébastien Hinderer
2017-04-08 16:56     ` Xavier Leroy
2017-04-09 19:50       ` Adrien Nader
2017-04-10  6:14         ` Ian Zimmerman
2017-04-10 13:20           ` Tao Stein
2017-04-10 13:45             ` Evgeny Roubinchtein
2017-04-10 14:04               ` Tao Stein
2017-04-10 18:07                 ` Adrien Nader
2017-04-10 19:45                   ` Hendrik Boom
2017-04-10 19:49                     ` Dušan Kolář
2017-04-11  0:38                       ` Tao Stein
2017-04-11 14:05 ` Richard W.M. Jones
2017-04-11 14:18   ` Gabriel Scherer
2017-04-11 14:59     ` Tao Stein
2017-04-11 17:17       ` Allan Wegan
2017-04-11 19:07         ` Glen Mével
2017-04-11 23:04           ` Allan Wegan
2017-04-12  0:12             ` Tao Stein
2017-04-16 22:37               ` Evgeny Roubinchtein
2017-04-09 17:15 Андрей Бергман

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1715c9d9-04d7-3368-bfbd-3af8aae4698b@inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).