You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Smigge <jo...@hotmail.com> on 2008/12/01 15:52:53 UTC

How to set the language for a date?

I'm using http://exslt.org/dates-and-times for creating dates, but it's
creating the times in my system language. I would like to change this to
English. How can this be done?

I'm also currently using the troublesome way of putting the formats, by
using date:month-abbreviation() and such separately instead of just putting
the date-format as a string. How could this be done in a more neat manner?
-- 
View this message in context: http://www.nabble.com/How-to-set-the-language-for-a-date--tp20773396p20773396.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: How to set the language for a date?

Posted by Smigge <jo...@hotmail.com>.

Jasha Joachimsthal-2 wrote:
> 
>  
>> -----Original Message-----
> If the transformer is not yet defined in your sitemap or its ancestors
> you'll have to define it in map:components --> map:transformers.
> 
> <map:transformer name="i18n"
>      src="org.apache.cocoon.transformation.I18nTransformer">
>      <catalogues default="messages">
>        <catalogue id="messages" name="messages"
> location="translations"/>
>        </catalogues>
> </map:transformer>
> 
> Jasha
>  
>> Isn't there a simple way of just changing the locale - even 
>> only within one
>> xslt?
> Then you have to do it by hand. You can pass a parameters to the xsl by
> using <map:parameter name="parametername" value="parametervalue"/>
> 
> Jasha Joachimsthal 
>  
> 

Mm... I knew I can pass parameters like that, but how does passing the
parameter help? I could define the language within the xslt, if I knew how. 

Any way, thanks for the help. Apparently I don't have to care about the date
format that much at this point.
-- 
View this message in context: http://www.nabble.com/How-to-set-the-language-for-a-date--tp20773396p20788939.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: How to set the language for a date?

Posted by Jasha Joachimsthal <j....@onehippo.com>.
 

> -----Original Message-----
> From: Smigge [mailto:jogilius@hotmail.com] 
> Sent: dinsdag 2 december 2008 9:22
> To: users@cocoon.apache.org
> Subject: RE: How to set the language for a date?
> 
> 
> 
> Jasha Joachimsthal-2 wrote:
> > 
> >  
> > 
> >> -----Original Message-----
> >> From: Smigge [mailto:jogilius@hotmail.com]
> >> Sent: dinsdag 2 december 2008 8:18
> >> To: users@cocoon.apache.org
> >> Subject: RE: How to set the language for a date?
> >> 
> >> 
> >> 
> >> 
> >> Jasha Joachimsthal-2 wrote:
> >> > 
> >> >  
> >> > 
> >> >> -----Original Message-----
> >> >> From: Smigge [mailto:jogilius@hotmail.com]
> >> >> Sent: maandag 1 december 2008 15:53
> >> >> To: users@cocoon.apache.org
> >> >> Subject: How to set the language for a date?
> >> >> 
> >> >> 
> >> >> I'm using http://exslt.org/dates-and-times for creating 
> dates, but 
> >> >> it's creating the times in my system language. I would
> >> like to change
> >> >> this to English. How can this be done?
> >> >> 
> >> >> I'm also currently using the troublesome way of putting
> >> the formats,
> >> >> by using date:month-abbreviation() and such separately 
> instead of 
> >> >> just putting the date-format as a string. How could this
> >> be done in a
> >> >> more neat manner?
> >> > 
> >> > By using the i18nTransformer
> >> > 
> http://cocoon.apache.org/2.1/userdocs/i18nTransformer.html#i18n_dat
> >> > e
> >> > 
> >> > 
> >> > Jasha Joachimsthal
> >> >  
> >> > j.joachimsthal@onehippo.com - jasha@apache.org
> >> >  
> >> > www.onehippo.com
> >> > Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam
> >> +31(0)20-5224466
> >> > San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA 
> >> > 94952-5100 +1 (707) 773-4646
> >> > 
> >> > 
> >> 
> ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >> > For additional commands, e-mail: users-help@cocoon.apache.org
> >> > 
> >> > 
> >> > 
> >> 
> >> Shouldn't it be somehow directly settable, since there is 
> an existing 
> >> lang attribute? By default it just takes the system 
> language, and I 
> >> just don't know how it should be set.
> >> 
> >> <date:date-format
> >>    name = qname
> >>    calendar = "gregorian" | qname-but-not-ncname
> >>    lang = language
> >>    first-day-of-week = "sunday" | "monday" | "tuesday" | 
> "wednesday" 
> >> | "thursday" | "friday" | "saturday" | string />
> >> --
> > 
> > You can pass the language to the i18n transformer through 
> the sitemap 
> > by using <map:transform type="i18n">
> > 	<map:parameter name="locale" value="en_US"/><!-- US English --> 
> > </map:transform>
> > 
> > 
> > Jasha Joachimsthal
> > 
> 
> Okay, this is probably a stupid question, but how? If I try to use the
> transformer without defining it first it says 
> 
> "Type 'i18n' is not defined for 'transform' at..."
> 
> And if I try define it in the transformers elements, it says:
> 
> "Unable to determine class name for component named 'i18n' "

If the transformer is not yet defined in your sitemap or its ancestors
you'll have to define it in map:components --> map:transformers.

<map:transformer name="i18n"
     src="org.apache.cocoon.transformation.I18nTransformer">
     <catalogues default="messages">
       <catalogue id="messages" name="messages"
location="translations"/>
       </catalogues>
</map:transformer>

Jasha
 
> 
> Isn't there a simple way of just changing the locale - even 
> only within one
> xslt?
Then you have to do it by hand. You can pass a parameters to the xsl by
using <map:parameter name="parametername" value="parametervalue"/>


Jasha Joachimsthal 
 
j.joachimsthal@onehippo.com - jasha@apache.org
 
www.onehippo.com
Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 
San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
94952-5100 +1 (707) 773-4646


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How to set the language for a date?

Posted by Joerg Heinicke <jo...@gmx.de>.
Smigge wrote:

> Isn't there a simple way of just changing the locale - even only within one
> xslt?

As you can see there is no standardized way of handling dates 
locale-aware in XSLT. I really recommend to do this using i18n 
functionality of Cocoon.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: How to set the language for a date?

Posted by Smigge <jo...@hotmail.com>.


Jasha Joachimsthal-2 wrote:
> 
>  
> 
>> -----Original Message-----
>> From: Smigge [mailto:jogilius@hotmail.com] 
>> Sent: dinsdag 2 december 2008 8:18
>> To: users@cocoon.apache.org
>> Subject: RE: How to set the language for a date?
>> 
>> 
>> 
>> 
>> Jasha Joachimsthal-2 wrote:
>> > 
>> >  
>> > 
>> >> -----Original Message-----
>> >> From: Smigge [mailto:jogilius@hotmail.com]
>> >> Sent: maandag 1 december 2008 15:53
>> >> To: users@cocoon.apache.org
>> >> Subject: How to set the language for a date?
>> >> 
>> >> 
>> >> I'm using http://exslt.org/dates-and-times for creating dates, but 
>> >> it's creating the times in my system language. I would 
>> like to change 
>> >> this to English. How can this be done?
>> >> 
>> >> I'm also currently using the troublesome way of putting 
>> the formats, 
>> >> by using date:month-abbreviation() and such separately instead of 
>> >> just putting the date-format as a string. How could this 
>> be done in a 
>> >> more neat manner?
>> > 
>> > By using the i18nTransformer
>> > http://cocoon.apache.org/2.1/userdocs/i18nTransformer.html#i18n_date
>> > 
>> > 
>> > Jasha Joachimsthal
>> >  
>> > j.joachimsthal@onehippo.com - jasha@apache.org
>> >  
>> > www.onehippo.com
>> > Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam 
>> +31(0)20-5224466 
>> > San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA 
>> > 94952-5100 +1 (707) 773-4646
>> > 
>> > 
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> > For additional commands, e-mail: users-help@cocoon.apache.org
>> > 
>> > 
>> > 
>> 
>> Shouldn't it be somehow directly settable, since there is an 
>> existing lang attribute? By default it just takes the system 
>> language, and I just don't know how it should be set. 
>> 
>> <date:date-format
>>    name = qname
>>    calendar = "gregorian" | qname-but-not-ncname
>>    lang = language
>>    first-day-of-week = "sunday" | "monday" | "tuesday" | 
>> "wednesday" | "thursday" | "friday" | "saturday" | string />
>> --
> 
> You can pass the language to the i18n transformer through the sitemap by
> using
> <map:transform type="i18n">
> 	<map:parameter name="locale" value="en_US"/><!-- US English -->
> </map:transform> 
> 
> 
> Jasha Joachimsthal 
> 

Okay, this is probably a stupid question, but how? If I try to use the
transformer without defining it first it says 

"Type 'i18n' is not defined for 'transform' at..."

And if I try define it in the transformers elements, it says:

"Unable to determine class name for component named 'i18n' "


Isn't there a simple of just changing the locale - even only within one
xslt?
-- 
View this message in context: http://www.nabble.com/How-to-set-the-language-for-a-date--tp20773396p20787797.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: How to set the language for a date?

Posted by Jasha Joachimsthal <j....@onehippo.com>.
 

> -----Original Message-----
> From: Smigge [mailto:jogilius@hotmail.com] 
> Sent: dinsdag 2 december 2008 8:18
> To: users@cocoon.apache.org
> Subject: RE: How to set the language for a date?
> 
> 
> 
> 
> Jasha Joachimsthal-2 wrote:
> > 
> >  
> > 
> >> -----Original Message-----
> >> From: Smigge [mailto:jogilius@hotmail.com]
> >> Sent: maandag 1 december 2008 15:53
> >> To: users@cocoon.apache.org
> >> Subject: How to set the language for a date?
> >> 
> >> 
> >> I'm using http://exslt.org/dates-and-times for creating dates, but 
> >> it's creating the times in my system language. I would 
> like to change 
> >> this to English. How can this be done?
> >> 
> >> I'm also currently using the troublesome way of putting 
> the formats, 
> >> by using date:month-abbreviation() and such separately instead of 
> >> just putting the date-format as a string. How could this 
> be done in a 
> >> more neat manner?
> > 
> > By using the i18nTransformer
> > http://cocoon.apache.org/2.1/userdocs/i18nTransformer.html#i18n_date
> > 
> > 
> > Jasha Joachimsthal
> >  
> > j.joachimsthal@onehippo.com - jasha@apache.org
> >  
> > www.onehippo.com
> > Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam 
> +31(0)20-5224466 
> > San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA 
> > 94952-5100 +1 (707) 773-4646
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> > 
> > 
> 
> Shouldn't it be somehow directly settable, since there is an 
> existing lang attribute? By default it just takes the system 
> language, and I just don't know how it should be set. 
> 
> <date:date-format
>    name = qname
>    calendar = "gregorian" | qname-but-not-ncname
>    lang = language
>    first-day-of-week = "sunday" | "monday" | "tuesday" | 
> "wednesday" | "thursday" | "friday" | "saturday" | string />
> --

You can pass the language to the i18n transformer through the sitemap by
using
<map:transform type="i18n">
	<map:parameter name="locale" value="en_US"/><!-- US English -->
</map:transform> 


Jasha Joachimsthal 
 
j.joachimsthal@onehippo.com - jasha@apache.org
 
www.onehippo.com
Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 
San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
94952-5100 +1 (707) 773-4646


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: How to set the language for a date?

Posted by Smigge <jo...@hotmail.com>.


Jasha Joachimsthal-2 wrote:
> 
>  
> 
>> -----Original Message-----
>> From: Smigge [mailto:jogilius@hotmail.com] 
>> Sent: maandag 1 december 2008 15:53
>> To: users@cocoon.apache.org
>> Subject: How to set the language for a date?
>> 
>> 
>> I'm using http://exslt.org/dates-and-times for creating 
>> dates, but it's creating the times in my system language. I 
>> would like to change this to English. How can this be done?
>> 
>> I'm also currently using the troublesome way of putting the 
>> formats, by using date:month-abbreviation() and such 
>> separately instead of just putting the date-format as a 
>> string. How could this be done in a more neat manner?
> 
> By using the i18nTransformer
> http://cocoon.apache.org/2.1/userdocs/i18nTransformer.html#i18n_date
> 
> 
> Jasha Joachimsthal 
>  
> j.joachimsthal@onehippo.com - jasha@apache.org
>  
> www.onehippo.com
> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 
> San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
> 94952-5100 +1 (707) 773-4646
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 

Shouldn't it be somehow directly settable, since there is an existing lang
attribute? By default it just takes the system language, and I just don't
know how it should be set. 

<date:date-format
   name = qname
   calendar = "gregorian" | qname-but-not-ncname
   lang = language
   first-day-of-week = "sunday" | "monday" | "tuesday" | "wednesday" |
"thursday" | "friday" | "saturday" | string />
-- 
View this message in context: http://www.nabble.com/How-to-set-the-language-for-a-date--tp20773396p20787253.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: How to set the language for a date?

Posted by Jasha Joachimsthal <j....@onehippo.com>.
 

> -----Original Message-----
> From: Smigge [mailto:jogilius@hotmail.com] 
> Sent: maandag 1 december 2008 15:53
> To: users@cocoon.apache.org
> Subject: How to set the language for a date?
> 
> 
> I'm using http://exslt.org/dates-and-times for creating 
> dates, but it's creating the times in my system language. I 
> would like to change this to English. How can this be done?
> 
> I'm also currently using the troublesome way of putting the 
> formats, by using date:month-abbreviation() and such 
> separately instead of just putting the date-format as a 
> string. How could this be done in a more neat manner?

By using the i18nTransformer
http://cocoon.apache.org/2.1/userdocs/i18nTransformer.html#i18n_date


Jasha Joachimsthal 
 
j.joachimsthal@onehippo.com - jasha@apache.org
 
www.onehippo.com
Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 
San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
94952-5100 +1 (707) 773-4646

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org