[Seaside] Re: [Pharo-users] i18n tools
Boris Popov, DeepCove Labs (SNN)
boris at deepcovelabs.com
Sun Sep 12 07:43:54 UTC 2010
VisualWorks has UserMessage that renders actual translated string based on the current process' locale (provided a matching catalog in that locale is available, of course) which is set by the session (technically a filter on the session). It also has an optional default string to support lazy catalog implementation. UserMessage instance can be created in code via,
#CatalogKey << #CatalogName >> 'Default String'
#CatalogKey << #CatalogName
-Boris (via BlackBerry)
----- Original Message -----
From: seaside-bounces at lists.squeakfoundation.org <seaside-bounces at lists.squeakfoundation.org>
To: Philippe Marschall <philippe.marschall at gmail.com>
Cc: Seaside - general discussion <seaside at lists.squeakfoundation.org>; Hilaire Fernandes <hilaire.fernandes at gmail.com>
Sent: Sat Sep 11 22:58:00 2010
Subject: Re: [Seaside] Re: [Pharo-users] i18n tools
2010/9/11 Philippe Marschall <philippe.marschall at gmail.com>:
>> Does it seem good idea to create class that is going to be translated
>> (but not yet is) and the translation
>> is resolved later.
> I don't quite follow.
Ok. I try to explain my idea better. With magritte you have to spell
out the error messages before you know anything about the locale of
the user who is going to see the messages. One can of course write
those error messages as plain strings and then write alternative
seaside component to translate the string later. However with this
kind of aproach there is no way to extract the translations for .pot
This problem (and the need for special translate: -seside method)
would go away if the String translate method would return object that
translates itself when the actual translated version is needed
(basically printOn: and renderOn: methods).
The main parts of the effective code would be something like this:
"answer the receiver translated to the default language"
^LazyTranslation fromString: self.
html text: (self translate: WACurrentLocalizationContext value localeID).
^(NaturalLanguageTranslator translate: msgid).
^(NaturalLanguageTranslator translate: msgid to: localeID).
Of course LazyTranslation should have to fake it string nature with
additional methods. The goal of this approach is simply decouple the
creation of translation and printing it using some locale. I hope this
made more sense.
seaside mailing list
seaside at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the seaside