Skip to Content.
Sympa Menu

en - [sympa-users] Re: Re: Upgrading sympa on FreeBSD

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Olivier Salaün <address@concealed>
  • To: Jose Marcio Martins da Cruz <address@concealed>
  • Cc: address@concealed
  • Subject: [sympa-users] Re: Re: Upgrading sympa on FreeBSD
  • Date: Tue, 07 Aug 2007 15:59:24 +0200

Attached is the promissed patch ; it has been applied on both subversion branches of Sympa.

Olivier Salaün a écrit :
One problem with locales is that the naming schema changes from one OS to another ; we've had problems on SunOS, HPUX and FreeBSD with this including different cases, charset mentionned or not, missing characters (dashes),...

One most OS the locales are named ll_CC.ISO-8859-N whereas on FreeBSD it is ll_CC.ISO8859-N, with a missing dash ('-') after the ISO part. Over the time, we've made Sympa try different locales to adapt to each OS, see Language::SetLang() :

[...]

It looks like we'll have to patch it again for FreeBSD users. We'll send a patch in this list today or tomorrow.

Jose Marcio Martins da Cruz a écrit :
I'm trying to upgrade sympa (5.2.1 -> 5.3.2) on FreeBSD.

When I type make, I get :

Checking available locales ...
#########################################################################################################
## IMPORTANT : Sympa is not able to use locales because they are not properly configured on this server
## You should activate some of the following locales :
## bg_BG cs_CZ de_DE el_GR en_US es_ES et_EE eu_ES fi_FI fr_FR hu_HU it_IT ja_JP nb_NO nl_NL oc_FR pl_PL pt_BR pt_PT ro_RO ru _RU sv_SE tr_TR zh_CN
## On Debian you should run the following command : dpkg-reconfigure locales
## On others systems, check /etc/locale.gen or /etc/sysconfig/i18n files
#########################################################################################################

But whey I check installed locales, I get :

$ locale -a | more
C
POSIX
af_ZA.ISO8859-1
af_ZA.ISO8859-15
af_ZA.UTF-8
[...]
Is it serious, doctor ??? How can I get rid of this ?

Index: src/Language.pm
===================================================================
--- src/Language.pm	(revision 4514)
+++ src/Language.pm	(working copy)
@@ -78,34 +78,6 @@
 		   'tr' => 'tr_TR',
 		   'tw' => 'zh_TW');
 
-## Used to define encoding for service messages sent by Sympa
-## Also used to perform setlocale on FreeBSD / Solaris
-my %locale2charset = ('bg_BG' => 'utf-8',
-		      'cs_CZ' => 'utf-8',
-		      'de_DE' => 'iso-8859-1',
-		      'el_GR' => 'utf-8',
-		      'en_US' => 'utf-8',
-		      'es_ES' => 'iso-8859-1',
-		      'et_EE' => 'iso-8859-4',
-		      'fi_FI' => 'iso-8859-1',
-		      'fr_FR' => 'iso-8859-1',
-		      'hu_HU' => 'iso-8859-2',
-		      'it_IT' => 'iso-8859-1',
-		      'ja_JP' => 'eucJP', # Case sensitive.
-		      'nb_NO' => 'utf-8',
-		      'nl_NL' => 'iso-8859-1',
-		      'oc_FR' => 'iso-8859-1',		      
-		      'pl_PL' => 'iso-8859-2',
-		      'pt_BR' => 'utf-8',
-		      'pt_PT' => 'iso-8859-1',
-		      'ro_RO' => 'iso-8859-2',
-		      'ru_RU' => 'utf-8',
-		      'sv_SE' => 'utf-8',
-		      'tr_TR' => 'utf-8',
-		      'zh_CN' => 'utf-8',
-		      'zh_TW' => 'big5',
-		      );
-
 ## We use different catalog/textdomains depending on the template that requests translations
 my %template2textdomain = ('help_admin.tt2' => 'web_help',
 			   'help_arc.tt2' => 'web_help',
@@ -178,12 +150,12 @@
     }
    
     ## Set Locale::Messages context
-    my $locale_dashless = $locale.'.'.$locale2charset{$locale}; 
+    my $locale_dashless = $locale.'.utf-8';
     $locale_dashless =~ s/-//g;
     foreach my $type (&POSIX::LC_ALL, &POSIX::LC_TIME) {
 	my $success;
-	foreach my $try ($locale.'.'.$locale2charset{$locale},
-			 $locale.'.'.uc($locale2charset{$locale}),  ## UpperCase required for FreeBSD
+	foreach my $try ($locale.'.utf-8',
+			 $locale.'.UTF-8',  ## UpperCase required for FreeBSD
 			 $locale_dashless, ## Required on HPUX
 			 $locale,
 			 $lang
@@ -210,7 +182,7 @@
 
     $current_lang = $lang;
     $current_locale = $locale;
-    $current_charset = $locale2charset{$locale};
+    $current_charset = 'utf-8';
 
     return $locale;
 }#SetLang
Index: po/check_locales.pl
===================================================================
--- po/check_locales.pl	(revision 4520)
+++ po/check_locales.pl	(working copy)
@@ -28,12 +28,23 @@
 
 my (@supported, @not_supported);
 
-foreach my $l (@locales) {
-    if (setlocale(&POSIX::LC_ALL, $l)) {
-	push @supported, $l;
-    }else {
-	push @not_supported, $l;
+foreach my $loc (@locales) {
+    my $locale_dashless = $loc.'.utf-8'; $locale_dashless =~ s/-//g;
+    my $lang = substr($loc, 0, 2);
+    my $success;
+    foreach my $try ($loc.'.utf-8',
+		     $loc.'.UTF-8',  ## UpperCase required for FreeBSD
+		     $locale_dashless, ## Required on HPUX
+		     $loc,
+		     $lang) {
+	if (setlocale(&POSIX::LC_ALL, $try)) {
+	    push @supported, $loc;
+	    $success = 1;
+	    last; 
+	}	
     }
+    push @not_supported, $loc unless ($success);
+
 }
 
 if ($#supported == -1) {
@@ -49,7 +60,7 @@
 }elsif ($#not_supported > -1){
     printf "#############################################################################################################\n";
     printf "## IMPORTANT : Sympa is not able to use all supported locales because they are not properly configured on this server\n";
-    printf "## Herer is a list on NOT supported locales :\n";
+    printf "## Herer is a list of NOT supported locales :\n";
     printf "##     %s\n", join(' ', @not_supported);
     printf "## On Debian you should run the following command : dpkg-reconfigure locales\n";
     printf "## On others systems, check /etc/locale.gen or /etc/sysconfig/i18n files\n";



Archive powered by MHonArc 2.6.19+.

Top of Page