[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [279] trunk/LedgerSMB/User.pm



Revision: 279
          http://svn.sourceforge.net/ledger-smb/?rev=279&view=rev
Author:   tetragon
Date:     2006-10-23 18:44:43 -0700 (Mon, 23 Oct 2006)

Log Message:
-----------
Actually commit changes to country_codes to convert to standard names

Modified Paths:
--------------
    trunk/LedgerSMB/User.pm

Modified: trunk/LedgerSMB/User.pm
===================================================================
--- trunk/LedgerSMB/User.pm	2006-10-24 01:37:49 UTC (rev 278)
+++ trunk/LedgerSMB/User.pm	2006-10-24 01:44:43 UTC (rev 279)
@@ -75,27 +75,27 @@
 
 
 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;
+
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.