Permalink
Browse files

* fixed t/date.t to look for locales with different file suffixes,

  as Template::Plugin::Date now does


git-svn-id: svn://svn.tt2.org/tt/Template2/trunk@537 d5a88997-0a34-4036-9ed2-92fb5d660d91
  • Loading branch information...
1 parent 7431aa3 commit f231acb6558be7768769b38052c08fde14cee0ea @abw committed Aug 16, 2002
Showing with 9 additions and 1 deletion.
  1. +9 −1 t/date.t
View
@@ -53,7 +53,15 @@ my $params = {
},
nowloc => sub { my ($time, $format, $locale) = @_;
my $old_locale = &POSIX::setlocale(&POSIX::LC_ALL);
- &POSIX::setlocale(&POSIX::LC_ALL, $locale);
+
+ # some systems expect locales to have a particular suffix
+ for my $suffix ('', @Template::Plugin::Date::LOCALE_SUFFIX) {
+ my $try_locale = $locale.$suffix;
+ if ($try_locale eq &POSIX::setlocale(&POSIX::LC_ALL, $try_locale)) {
+ $locale = $try_locale;
+ last;
+ }
+ }
my $datestr = &POSIX::strftime($format, localtime($time));
&POSIX::setlocale(&POSIX::LC_ALL, $old_locale);
return $datestr;

0 comments on commit f231acb

Please sign in to comment.