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

Bug#624150: www.debian.org: Please use iso-codes to translate language and country names



Package: www.debian.org
Severity: wishlist
Tags: patch l10n
User: www.debian.org@packages.debian.org
Usertags: scripts international

Hi,

It would be pointless to fix all #556394-like bug one language at a
time, and since those translations already exists, there is no point
to ask each translators team to provide those translations again.

Moreover, Locale::Language is not complete in regard to ISO 639-3.

In order to apply the following patch, isoquery and iso-codes must be
installed on wolkenstein.

I'll continue to prepare patches for other parts of the website that
rely on internal translation unless someone objects. The last three
changes are unrelated: Alexander Reshetov suggested to get rid of the
parenthesis and I tend to agree. I also wonder if we shouldn't separate
the language of the country by a simple dash (like in French), instead
of using a (translatable) “, as spoken in” form, which may lead to
problems in some languages (see #444965). Please note that the build
process of intl/l10n would take more time, probably because of the
external call to isoquery, but it's only built once a day.

Result (in every available language) is available online, if my ISP
does its job:

	http://www.tilapin.org/debian/intl/l10n/po/

Regards

David

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (600, 'unstable'), (500, 'oldstable'), (500, 'stable'), (150, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38-2-amd64 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

*** /tmp/dtc.def.patch
Index: english/international/l10n/dtc.def
===================================================================
RCS file: /cvsroot/webwml/webwml/english/international/l10n/dtc.def,v
retrieving revision 1.50
diff -u -r1.50 dtc.def
--- english/international/l10n/dtc.def	18 Sep 2008 21:12:58 -0000	1.50
+++ english/international/l10n/dtc.def	26 Apr 2011 01:26:53 -0000
@@ -1,4 +1,3 @@
-#use wml::debian::language_names
 #use wml::debian::common_tags
 
 <bind-gettext-domain domain="l10n" />
@@ -139,38 +138,45 @@
 </table>
 </define-tag>
 
-#use wml::debian::language_names
-
 <:
 use lib '$(ENGLISHDIR)/../Perl';
 use Locale::Language;
-use Locale::Country;
+use Locale::gettext;
 
 sub language_name {
         my $lang=shift;
         my $country=undef;
+	my $loc=language2code($(CUR_LANG));
 
+	$lang  =~ s/@.*$//;
         if ($lang =~ m,^(..)_(..)$,) {
                 $lang=$1;
                 $country=$2;
         }
-        # Looking for something like $trans{'de'}{'finnish'}
-        # Translations in wml::debian::language_names
-        if (defined ($trans{language2code($(CUR_LANG))}{lc(code2language($lang))})) {
-	        $lang = $trans{language2code($(CUR_LANG))}{lc(code2language($lang))};
+        if (`isoquery -i 639-3 --name $lang 2>/dev/null`) {
+		# isoquery fails for unavailable locale, included en, see #624147
+		if ($loc eq 'en'){
+			$lang = `isoquery -i 639-3 -n $lang`;
+		}
+		else {
+			$lang = `isoquery -i 639-3 -l $loc -n $lang`;
+		}
+		chomp $lang;
+		$lang =~ s/^.*\t//g;
         } else {
-                $lang = code2language($lang) or return qq(<Unknown_Language>);
+                return qq(<Unknown_Language>);
         }
         if (defined $country) {
-	        $country=uc($country);
-	        # Looking for something like $countries{'AT'}{'FI'} (for _AT in finnish
-                if (defined ($countries{$country}{uc(language2code($(CUR_LANG)))})) {
-		        $country=$countries{$country}{uc(language2code($(CUR_LANG)))};
-                } elsif (defined ($countries{$country}{'EN'})) {
-	                $country=$countries{$country}{'EN'};
-                } elsif (defined (code2country($country))) {
-	 	        $country=code2country($country);
+		if (`isoquery --name $country 2>/dev/null`) {
+			if ($loc eq 'en'){
+				$country = `isoquery --name $country`;
+			}
+			else {
+				$country = `isoquery -l $loc --name $country`;
+			}
                 }
+		chomp $country;
+		$country =~ s/^.*\t//g;
 	        return "<langcountryoutput $lang $country>";
         } else {
                 return $lang;
@@ -196,7 +202,7 @@
 close(LANGS);
 print "<ul>\n" if (@po4alangs);
 foreach my $l (sort @po4alangs) {
-        print "<li>$l (<a href=\"$l\">".language_name($l)."</a>)</li>\n";
+        print "<li>$l &mdash; <a href=\"$l\">".language_name($l)."</a></li>\n";
 }
 print "</ul>\n" if (@po4alangs);
 :>
@@ -232,7 +238,7 @@
 close(LANGS);
 print "<ul>\n" if (@polangs);
 foreach my $l (sort @polangs) {
-        print "<li>$l (<a href=\"$l\">".language_name($l)."</a>)</li>\n";
+        print "<li>$l &mdash; <a href=\"$l\">".language_name($l)."</a></li>\n";
 }
 print "</ul>\n" if (@polangs);
 :>
@@ -268,7 +274,7 @@
 close(LANGS);
 print "<ul>\n" if (@podebconflangs);
 foreach my $l (sort @podebconflangs) {
-        print "<li>$l (<a href=\"$l\">".language_name($l)."</a>)</li>\n";
+        print "<li>$l &mdash; <a href=\"$l\">".language_name($l)."</a></li>\n";
 }
 print "</ul>\n" if (@podebconflangs);
 :>



Reply to: