D Conference Tango Phobos

Janice Caron caron800 at googlemail.com
Sat Sep 15 02:57:35 PDT 2007


On 9/15/07, renoX <renosky at free.fr> wrote:
> So instead of having "Prenom {0}, Nom {1}", firsname, name" you would
> have "Prenom %{firstname} Name %{name}".

I don't believe that helps. For internationalisation, you would
typically retrieve the format string from a database created by
translators (i.e. human beings who are multilingual). The notion is to
separate the translators from the programmers. So the actual
programming code wouldn't look like

printf_like_function("Prenom {0}, Nom {1}", firsname, name)

rather, it's more likely to look like

printf_like_function(translate[NAME],firstname,lastname).

The string value returned by translate[NAME] should not need to be
aware of what variable names are later going to be substituted into it
(which might in any case be different at different points in the
program).

The model is, programmers write the code, then translators provide the
international translations. The goal is to minimise the dependency
between the two. Therefore, I believe that substitution by argument
index is the right thing to do.



More information about the Digitalmars-d mailing list