=cut
tie our %locales, 'Tie::IxHash',
- 'en_US', { name => 'English', country => 'United States', },
- 'iw_IL', { name => 'Hebrew', country => 'Israel', rtl=>1, },
+ 'en_US', { name => 'English', country => 'United States', },
+ 'en_AU', { name => 'English', country => 'Australia', },
+ 'en_CA', { name => 'English', country => 'Canada', },
+ 'fr_CA', { name => 'French', country => 'Canada', },
+ 'fr_FR', { name => 'French', country => 'France', },
+ 'fr_HT', { name => 'French', country => 'Haiti', },
+ 'ht_HT', { name => 'Haitian Creole', country => 'Haiti', },
+ 'iw_IL', { name => 'Hebrew', country => 'Israel', rtl=>1, },
;
+$_->{label} = $_->{name} . ' (' . $_->{country} . ')'
+ foreach values %locales;
+
sub locales {
keys %locales;
}
sub locale_info {
my($class, $locale) = @_;
- %{ $locales{$locale} };
+ if (!$locale) {
+ return ();
+ } elsif (exists $locales{$locale}) {
+ return %{ $locales{$locale} };
+ } else {
+ die "unsupported locale '$locale'\n";
+ }
+}
+
+=item description LOCALE
+
+Returns "Language (Country)" for a locale.
+
+=cut
+
+sub description {
+ my($class, $locale) = @_;
+ $locales{$locale}->{'name'} . ' (' . $locales{$locale}->{'country'} . ')';
}
=back