From: "Moritz Onken" <on...@houseofdesign.de>
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
I found that I can use
$class_name->date_field->set_locale('ro')->month_name
I found that the last version of the Catalyst DBIC::Schema helper adds
InflateColumn::DateTime component by default, and until now I was using a
raw date like
[% row.date %]
and it printed a date like 2009-04-24.
Now it prints it as 2009-04-24T00:00:00.
I wanted to correct this and this is how I became interested about also
localizing the dates.
Thanks.
Octavian
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/