[Catalyst] setting the locale with DBIx::Class::InflateColumn::DateTime

Moritz Onken onken at houseofdesign.de
Fri Apr 24 09:48:45 GMT 2009


Am 24.04.2009 um 10:53 schrieb Octavian Rasnita:

> Hi,
>
> (Sorry for asking on this list, but my messages are rejected from  
> DBIC mailing list.)
>
> Is it possible to set the locale for a certain date field if  
> DBIx::Class::InflateColumn::DateTime is used when using that date,  
> and not in the class definition?
>
> I don't think it is OK to hard code the locale for a certain column  
> in the class definition, because the data from that column might be  
> presented in different languages, for different locales.
>
> In the POD documentation of DBIx::Class::InflateColumn::DateTime  
> I've learned how to set the locale for the date columns, but only by  
> setting it in the class definition.
>
> I've tried to set it when I used it, like
>
> $class->date_field->month_name(locale => 'ro_RO')
> or
> $class->date_field->month_name({locale => 'ro_RO'})
>
> with no luck, of course.
>
> Thank you for any hints.

IMHO this is something the view should handle. The model's output  
should stay the same regardless of which locale the user has.

What view classes are you using? I usually write a TT macro which sets  
the locale and/or timezone to the user's preferences.


moritz



More information about the Catalyst mailing list