invoice template and config localization, #12367
[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_CA', { name => 'English',     country => 'Canada', },
32   'en_US', { name => 'English',     country => 'United States', },
33   'fr_CA', { name => 'French',      country => 'Canada', },
34   'fr_FR', { name => 'French',      country => 'France', },
35   'iw_IL', { name => 'Hebrew',      country => 'Israel', rtl=>1, },
36 ;
37
38 sub locales {
39   keys %locales;
40 }
41
42 =item locale_info LOCALE
43
44 Returns a hash of information about a locale.
45
46 =cut
47
48 sub locale_info {
49   my($class, $locale) = @_;
50   %{ $locales{$locale} };
51 }
52
53 =item description LOCALE
54
55 Returns "Language (Country)" for a locale.
56
57 =cut
58
59 sub description {
60   my($class, $locale) = @_;
61   $locales{$locale}->{'name'} . ' (' . $locales{$locale}->{'country'} . ')';
62 }
63
64 =back
65
66 =head1 BUGS
67
68 =head1 SEE ALSO
69
70 L<FS::Msgcat>
71
72 =cut
73
74 1;
75