On 2008-Jan-31, at 2:38 am, Mark Overmeer wrote:
* David Green ([EMAIL PROTECTED]) [080131 08:48]:
I've always wanted a magic-S (and I don't think the anglocentrism
matters
In "the good old days" all computer OSes were anglo-centric. They are
not like that anymore. But Perl still is.
Well, they provide ways to localise text, which is good; and a lot of
applications take advantage of it, which is better. Most programming
languages themselves are still English though, or at least their
vocabulary is based on English and English-like words. (Except for
the ones that aren't.) Fortunately, since Perl6 is ultimately
mutable, it should be reasonably straightforward to translate it all
so that you could start programs with "use Dutch" or "use Japanese".
use Lingua::FR;
mes @valeurs=(1,2,3);
dis $_ pour @valeurs; #pardon my French
Of course, while some languages might need only to translate all the
function and variable names, others would arguably want to rearrange
the grammar and syntax too, so "reasonably straightforward" is a
relative term....
The brute force way would be to redefine every function with a new
name for the new language; but perhaps what we really want is a more
elegant way to do that:
sub foo :trans(fr=>"fue", de=>"fu") {...}
I do not think that your use Locale::Lingua::Romana::Perligata;
is usable, because the translation (in general) adapts to the language
of the user of the module, not the likings of the author.
That depends on the circumstances; the author(s) still have to provide
translations in the first place. I wasn't thinking of ways to handle
multiple languages, just ways to let the author more easily use his
own language (which is what the majority of perl programs do, since
most of them are written for private use).
As I suggested in a previous mail, we can do it by making say/print
a bit smarter. Instead of interpolating before they are called,
we let them interpolate themselves, and optionally translate.
I really like the idea of having text lazily interpolate/translate.
And in P6, it will be possible to override quoting and concatenating
so that the code doesn't even have to look any different. Being able
to refer to the interpolated values is a bit of a different matter, I
think; although I guess the main reason for wanting to do so is
translating (including singular-to-plural "translations").
Flexible interpolation is good because it makes text look more
natural, as opposed to a printf-like separation of parts. On the
other hand, the more natural the text looks in one language, the more
work it can be to translate it automatically. The magic-S is more of
a shortcut when you're not doing "real" translations at all.
-David