cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject Re: i18n questions
Date Sat, 10 Apr 2004 10:13:39 GMT

On 9 Apr 2004, at 17:11, Joerg Heinicke wrote:

> On 09.04.2004 12:36, Jeremy Quinn wrote:
>
>> Hi All
>> I use i18n a lot with Woody and Flowscript. I prefer to keep all user 
>> message strings out of woody files and flowscripts, regardless of 
>> whether the project needs translating to another language.
>
> I do the same for my project.
>
>>  I have a couple of situations where I have not worked out how to use 
>> i18n effectively. Both are related to dynamic selectionlists. Are 
>> there solutions for these?
>> 1. We need to internationalise custom fail messages. Placing i18n 
>> tags inside do not result in their being looked up. We cannot use 
>> Woody's built-in message because it would mean nothing in to the 
>> User, as we are testing to see if they have left the menu in it's 
>> default unset state by checking the value is greater than 0.
>
> Tested it with CForms samples and it works for me:

<snip/>

I had better try again ...

>
> Now using the i18n transformer afterwards everything should go on as 
> normal. Hopefully the feature was not added between your Woody version 
> and the recent CForms version.

Was this a recent addition ?

<snip/>

>> function getSelectionList (session, classname) {
>>     var list = SimpleDescriptorPeer.list (session, classname);
>>     var selectionlist = new Array (list.size () +1);
>>     selectionlist[0] = {value: SimpleDescriptor.NO_VALUE, label: 
>> "Choose One"}; // i18n this string
>
> Do not really know, but maybe it works when instead setting label to a 
> string setting it to I18nMessage would work? Something like
>
> var i18nLabel = new 
> Packages.org.apache.cocoon.forms.util.I18nMessage("key");
> selectionlist[0] = {value: SimpleDescriptor.NO_VALUE, label: 
> i18nLabel};

Ah Ha !!!!
That looks like it would work !!

>>     for (var i = 0; i < list.size (); i++)
>>         selectionlist[i+1] = {value: list.get (i).id, label: list.get 
>> (i).name};
>>     return out;
>> }
>> These sample points out another gritty little issue.
>> The flowscript uses SimpleDescriptor.NO_VALUE, fine, but Woody has to 
>> use <wd:range min="1"> while they are both referring to the same 
>> value (+1 in woody's case).
>
> Don't understand this.

Sorry, I did not explain that very well.

We have several situations where it would be useful to be able to use 
Package references to static properties from i18n keys or woody model 
declarations.

eg.

<wd:range min="#{Packages.blah.SimpleDescriptor.MIN_VALUE}">

or

<message key="search.#{Packages.blah.Query.EQUALS_MATCH}.match">exactly 
matches</message>

as this saves you keeping declarations of the same value synchronised 
between display and backend.

I suppose I could turn all of my i18n message files and woody models 
into JX Templates, but I am not fond of the idea.

Thanks

regards Jeremy
Mime
View raw message