add en_AU locale, make sure "Zip" is translate-able, RT#28081
[freeside.git] / FS / FS / Locales.pm
1 package FS::Locales;
2
3 use strict;
4 use Tie::IxHash;
5
6 =head1 NAME
7
8 FS::Locales - Supported locales
9
10 =head1 SYNOPSIS
11
12   use FS::Locales;
13
14   my @locales = FS::Locales->locales;
15
16 =head1 DESCRIPTION
17
18 FS::Locales provides a list of supported locales.
19
20 =head1 CLASS METHODS
21
22 =over 4
23
24 =item locales
25
26 Returns a list of the available locales.
27
28 =cut
29
30 tie our %locales, 'Tie::IxHash',
31   'en_US', { name => 'English',        country => 'United States', },
32   'en_AU', { name => 'English',        country => 'Australia', },
33   'en_CA', { name => 'English',        country => 'Canada', },
34   'fr_CA', { name => 'French',         country => 'Canada', },
35   'fr_FR', { name => 'French',         country => 'France', },
36   'fr_HT', { name => 'French',         country => 'Haiti', },
37   'ht_HT', { name => 'Haitian Creole', country => 'Haiti', },
38   'iw_IL', { name => 'Hebrew',         country => 'Israel', rtl=>1, },
39 ;
40
41 $_->{label} = $_->{name} . ' (' . $_->{country} . ')'
42   foreach values %locales;
43
44 sub locales {
45   keys %locales;
46 }
47
48 =item locale_info LOCALE
49
50 Returns a hash of information about a locale.
51
52 =cut
53
54 sub locale_info {
55   my($class, $locale) = @_;
56   if (!$locale) {
57     return ();
58   } elsif (exists $locales{$locale}) {
59     return %{ $locales{$locale} };
60   } else {
61     die "unsupported locale '$locale'\n";
62   }
63 }
64
65 =item description LOCALE
66
67 Returns "Language (Country)" for a locale.
68
69 =cut
70
71 sub description {
72   my($class, $locale) = @_;
73   $locales{$locale}->{'name'} . ' (' . $locales{$locale}->{'country'} . ')';
74 }
75
76 =back
77
78 =head1 BUGS
79
80 =head1 SEE ALSO
81
82 L<FS::Msgcat>
83
84 =cut
85
86 1;
87