<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>Re: [Seaside] Re: [Pharo-users] i18n tools</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>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,<BR>
<BR>
#CatalogKey &lt;&lt; #CatalogName &gt;&gt; 'Default String'<BR>
<BR>
or,<BR>
<BR>
#CatalogKey &lt;&lt; #CatalogName<BR>
<BR>
-Boris (via BlackBerry)<BR>
<BR>
----- Original Message -----<BR>
From: seaside-bounces@lists.squeakfoundation.org &lt;seaside-bounces@lists.squeakfoundation.org&gt;<BR>
To: Philippe Marschall &lt;philippe.marschall@gmail.com&gt;<BR>
Cc: Seaside - general discussion &lt;seaside@lists.squeakfoundation.org&gt;; Hilaire Fernandes &lt;hilaire.fernandes@gmail.com&gt;<BR>
Sent: Sat Sep 11 22:58:00 2010<BR>
Subject: Re: [Seaside] Re: [Pharo-users] i18n tools<BR>
<BR>
2010/9/11 Philippe Marschall &lt;philippe.marschall@gmail.com&gt;:<BR>
&gt;&gt; Does it seem good idea to create class that is going to be translated<BR>
&gt;&gt; (but not yet is) and the translation<BR>
&gt;&gt; is resolved later.<BR>
&gt; I don't quite follow.<BR>
<BR>
Ok. I try to explain my idea better. With magritte you have to spell<BR>
out the error messages before you know anything about the locale of<BR>
the user who is going to see the messages. One can of course write<BR>
those error messages as plain strings and then write alternative<BR>
seaside component to translate the string later. However with this<BR>
kind of aproach there is no way to extract the translations for .pot<BR>
file.<BR>
<BR>
This problem (and the need for special translate: -seside method)<BR>
would go away if the String translate method would return object that<BR>
translates itself when the actual translated version is needed<BR>
(basically printOn: and renderOn: methods).<BR>
<BR>
The main parts of the effective code would be something like this:<BR>
<BR>
String&gt;&gt;translated<BR>
&quot;answer the receiver translated to the default language&quot;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^LazyTranslation fromString: self.<BR>
<BR>
LazyTranslation&gt;&gt;renderOn: html<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; html text: (self translate: WACurrentLocalizationContext value localeID).<BR>
<BR>
LazyTranslation&gt;&gt;printOn: aStream<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^self translate.<BR>
<BR>
LazyTranslation&gt;&gt;translate<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^(NaturalLanguageTranslator translate: msgid).<BR>
<BR>
LazyTranslation&gt;&gt;translate: localeID<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^(NaturalLanguageTranslator translate: msgid to: localeID).<BR>
<BR>
<BR>
Of course LazyTranslation should have to fake it string nature with<BR>
additional methods. The goal of this approach is simply decouple the<BR>
creation of translation and printing it using some locale. I hope this<BR>
made more sense.<BR>
<BR>
<BR>
--<BR>
Panu<BR>
_______________________________________________<BR>
seaside mailing list<BR>
seaside@lists.squeakfoundation.org<BR>
<A HREF="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</A><BR>
</FONT>
</P>

</BODY>
</HTML>