Re: ANNOUNCE: DateTime::Fiction::JRRTolkien::Shire 0.02
+-Le 07/12/2003 17:30 -0700, Tom Braun écrivait : | First Release. Port of Date::Tolkien::Shire to the DateTime framework. | | Includes everything Date::Tolkien::Shire did, including the on this date | in history stuff. Times are maintained for conversion but not otherwise | supported (How do Hobbits track time anyway?). Date math isn't yet | supported. Shouldn't this be a DateTime::Calendar:: thing ? -- Mathieu Arnold
RE: ANNOUNCE: DateTime::Fiction::JRRTolkien::Shire 0.02
Shouldn't this be a DateTime::Calendar:: thing ? This was discussed a while back (see Dave Rolsky's email Re: Final Word on Imaginary Calendars dated April 23). The decision was made to seperate out calendars from works of fiction from real calendars by putting them in a seperate namespace. So DateTime::Calendar:: and DateTime::Fiction:: are both calendars. Tom
How to get a localized string
Couldn't find this in the FAQ... If I create a datetime with a locale, $dt = DateTime-now(locale='fr_FR'); I know there is a locale in that datetime object... $dt-locale and I know that locale knows what formatting it prefers (such as day-month-year versus month-day-year abbreviations). But is there an less verbose way to pull it out than this: $dt-strftime($dt-locale-date_formats-{'medium'}); I was hoping for something like $dt-medium_format does it exist? -Doug
Re: How to get a localized string
On Mon, 8 Dec 2003, Doug Treder wrote: and I know that locale knows what formatting it prefers (such as day-month-year versus month-day-year abbreviations). But is there an less verbose way to pull it out than this: $dt-strftime($dt-locale-date_formats-{'medium'}); I was hoping for something like $dt-medium_format does it exist? $dt-locale-medium_date_format The locale classes need better docs, I think. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
ANNOUNCE: DateTime::Locale 0.06
0.06 2003-12-08 - The DateTime::Locale docs now includes docs for all the methods that a locale object has. No notable code changes. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: How to get a localized string
So...it would look like: $dt-strftime($dt-locale-medium_date_format); could we get a shortcut method like: $dt-locale_strftime('medium'); the object should be able to use the locale it already contains; I shouldn't have to pass it in. We already have shortcuts for -mdy, -dmy, -hms so there should be a nice little shortcut for a locale-aware getter. The presence of the former in the documentation might lead one to believe an if statement would be the best way to localize this use case (m/d/y vs d/m/y). -D Dave Rolsky wrote: On Mon, 8 Dec 2003, Doug Treder wrote: and I know that locale knows what formatting it prefers (such as day-month-year versus month-day-year abbreviations). But is there an less verbose way to pull it out than this: $dt-strftime($dt-locale-date_formats-{'medium'}); I was hoping for something like $dt-medium_format does it exist? $dt-locale-medium_date_format The locale classes need better docs, I think. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: How to get a localized string
On Mon, 8 Dec 2003, Doug Treder wrote: the object should be able to use the locale it already contains; I shouldn't have to pass it in. We already have shortcuts for -mdy, -dmy, -hms so there should be a nice little shortcut for a locale-aware getter. The presence of the former in the documentation might lead one to believe an if statement would be the best way to localize this use case (m/d/y vs d/m/y). We do already have $dt-strftime('%x') but the length of the output depends on the default date format length for the locale. AFAICT, for all locales this is currently medium. But that's not necessarily enough. If we're going to add more methods that output localized _numeric_, they need to be well thought out. A locale_strftime method that doesn't take format specifiers is really confusing, particularly since you propose to have it just output the date, but others will want datetime, time, etc. Maybe something like: $dt-localized_date $dt-localized_time $dt-localized_datetime Each of these could accept an optional length argument. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: How to get a localized string
Good point, for example: $dt = DateTime-now(locale=fr_FR); # france french print $dt-strftime('%x'); '9 déc. 03' $dt = DateTime-now(locale=fr_CA); # canadian french print $dt-strftime('%x'); '03-12-09' the medium format may or may not be numeric. or is one of the two locale modules wrong? -D Dave Rolsky wrote: On Mon, 8 Dec 2003, Doug Treder wrote: the object should be able to use the locale it already contains; I shouldn't have to pass it in. We already have shortcuts for -mdy, -dmy, -hms so there should be a nice little shortcut for a locale-aware getter. The presence of the former in the documentation might lead one to believe an if statement would be the best way to localize this use case (m/d/y vs d/m/y). We do already have $dt-strftime('%x') but the length of the output depends on the default date format length for the locale. AFAICT, for all locales this is currently medium. But that's not necessarily enough. If we're going to add more methods that output localized _numeric_, they need to be well thought out. A locale_strftime method that doesn't take format specifiers is really confusing, particularly since you propose to have it just output the date, but others will want datetime, time, etc. Maybe something like: $dt-localized_date $dt-localized_time $dt-localized_datetime Each of these could accept an optional length argument. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: ANNOUNCE: DateTime::Fiction::JRRTolkien::Shire 0.02
On Mon, 8 Dec 2003, Mathieu Arnold wrote: Shouldn't this be a DateTime::Calendar:: thing ? http://datetime.perl.org/developer/namespace.html -J --
Re: DateTime - no Arizona time zone?
[ cc'ing this back to the list ] On Mon, 8 Dec 2003, Mike Schilli wrote: I'm using your DateTime::TimeZone module extensively right now -- it's great! Hey, one thing I noticed: How can you determine the time zone of Arizona, because they don't have daylight savings time there (besides in the Navajo indian reservation) and the rest of the US (almost) has it. There doesn't seem to be a DateTime::TimeZone::America::Arizona folder, It's America/Phoenix. Time zone names are always [continent or ocean]/city I should have a list be included in the DateTime::TimeZoneCatalog docs. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: How to get a localized string
On Mon, 8 Dec 2003, Doug Treder wrote: Good point, for example: $dt = DateTime-now(locale=fr_FR); # france french print $dt-strftime('%x'); '9 déc. 03' $dt = DateTime-now(locale=fr_CA); # canadian french print $dt-strftime('%x'); '03-12-09' the medium format may or may not be numeric. or is one of the two locale modules wrong? That's just what the locale data says. There's no way to know whether or not a given locale will use only numbers in the output other than looking at the output. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: How to get a localized string
Dave Rolsky wrote: On Mon, 8 Dec 2003, Doug Treder wrote: $dt = DateTime-now(locale=fr_CA); # canadian french print $dt-strftime('%x'); '03-12-09' the medium format may or may not be numeric. or is one of the two locale modules wrong? That's just what the locale data says. There's no way to know whether or not a given locale will use only numbers in the output other than looking at the output. Here in Quebec 03-12-09 would normally be interpreted as December 3, 2009. I would expect 9-12-2003 (expressing years in two digits is frowned upon; e.g. 1998-99 is considered an anglicism, the proper way to write it being 1998-1999). The string version would be le 9 décembre 2003; month abbreviations tend to be used only where space is limited (as in a table), and preceding dates with le is almost invariable, even where the would never be used in English. I'm left wondering if the 03-12-09 isn't an ISO-standard placeholder for not sure of locale data, or based on a Canada is officially metric, ergo ISO rules premise out of touch with common usage (even for en_CA I would expect 12/09/03, not the preferable-for-the-sake-of-clarity y-m-d). h~