----- Original Message -----
From: "Brian Candler" <B.Candler / pobox.com>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Tuesday, July 01, 2003 5:01 AM
Subject: Re: Message catalogs (I18N) overnight hack...


> Maybe such a low-level transparent translation belongs either in String,
or
> in the IO class, rather than overriding all the various Kernel#puts-type
> methods.

Well, that's a thought. I'm not sure I see all of the implications
at this hour of the morning. Too much blood in my caffeine stream.

> But I take your point that it's your project so it's up to you to design
it
> how you like :-)

Ha... well, not all design changes are created equal.

If I'm designing a horse, and someone says, "If you added a horn, you
could have a unicorn" -- well, that is interesting. But if someone
says, "Drop the hooves and hair, skip the mammal bit, change the legs
and add four more, and make it ocean-living -- you could have an
octopus!" -- well, that is different. :)

> I don't think I'd use the proposed style of library. Firstly it would be
> very difficult to ensure complete coverage of all strings having
> translations [unless there was a utility to parse the Ruby source to
extract
> all strings, and tie them up against all translations, and highlight any
> missing ones]

What would partially address this would be the warning and logging
features I mentioned (not implemented).

Logging would capture all strings as they were output, for later
translation.
Warning would print an explicit warning when an untranslated string was
found. These would of course have to be turned on explicitly. Then you would
just need good code coverage, as from a set of testcases.

> Also I'd be a bit concerned about phrases where the word order might need
to
> be different in different languages:
>
>     printf("I gave the %s to %s", thing, recipient)

I address this issue. The prepared message can contain %n markers like
%1, %2, %3... in matching, these basically become (.*?) patterns.

Some of my contrived examples dealt with this issue, like the "User foo..."
example.

> Also, do we worry about languages where word endings change dependent on
> function? Languages which require noun.capitalize ?

Word endings are an issue. Sometimes people store plurals separately, e.g.,
file=>Datei, files=>Dateien and so on. This is an area which pushes the
limits of my knowledge both of I18N programming and languages in general.

As for capitalizing... hmm. I don't offhand see where anything would ever
have to be capitalized that was not hardcoded in the translated message.

But there are several little issues like that, that I'm not addressing yet.
Someone mentioned the decimal point issue. I hate to think about that.

Hal