summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-24 01:44:43 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-24 01:44:43 +0000
commit02c6d652486e452bd088e105b395a9cd49639d02 (patch)
tree7b7b46d77de1f3e44d97481d8254a51e400f3f38 /LedgerSMB
parentf8c8266367055d67f4527e90ac3edbb4f2bd7635 (diff)
Actually commit changes to country_codes to convert to standard names
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@279 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-xLedgerSMB/User.pm32
1 files changed, 16 insertions, 16 deletions
diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm
index 514fc4a9..dc346822 100755
--- a/LedgerSMB/User.pm
+++ b/LedgerSMB/User.pm
@@ -75,26 +75,26 @@ sub new {
sub country_codes {
+ use Locale::Country;
+ use Locale::Language;
- my %cc = ();
- my @language = ();
-
- # scan the locale directory and read in the LANGUAGE files
- opendir DIR, "locale";
+ my %cc = ();
+
+ # scan the locale directory and read in the LANGUAGE files
+ opendir DIR, "${LedgerSMB::Sysconfig::localepath}";
- my @dir = grep !/(^\.\.?$|\..*)/, readdir DIR;
-
- foreach my $dir (@dir) {
- next unless open(FH, "locale/$dir/LANGUAGE");
- @language = <FH>;
- close FH;
+ my @dir = grep !/(^\.\.?$|\..*)/, readdir DIR;
- $cc{$dir} = "@language";
- }
+ foreach my $dir (@dir) {
+ $cc{$dir} = code2language(substr($dir, 0, 2));
+ $cc{$dir} .= ("/" . code2country(substr($dir, 3, 2)))
+ if length($dir) > 2;
+ $cc{$dir} .= (" " . substr($dir, 6)) if length($dir) > 5;
+ }
- closedir(DIR);
-
- %cc;
+ closedir(DIR);
+
+ %cc;
}