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

Package: www.debian.org; Maintainer for www.debian.org is Debian WWW Team <debian-www@lists.debian.org>;

Reported by: David Prévot <david@tilapin.org>

Date: Tue, 26 Apr 2011 03:06:25 UTC

Severity: wishlist

Tags: l10n, patch

Done: David Prévot <david@tilapin.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian WWW Team <debian-www@lists.debian.org>:
Bug#624150; Package www.debian.org. (Tue, 26 Apr 2011 03:06:27 GMT) Full text and rfc822 format available.

Acknowledgement sent to David Prévot <david@tilapin.org>:
New Bug report received and forwarded. Copy sent to Debian WWW Team <debian-www@lists.debian.org>. (Tue, 26 Apr 2011 03:06:27 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: David Prévot <david@tilapin.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: www.debian.org: Please use iso-codes to translate language and country names
Date: Mon, 25 Apr 2011 23:04:32 -0400
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 sent to David Prévot <david@tilapin.org>:
You have taken responsibility. (Wed, 27 Apr 2011 17:39:06 GMT) Full text and rfc822 format available.

Notification sent to David Prévot <david@tilapin.org>:
Bug acknowledged by developer. (Wed, 27 Apr 2011 17:39:07 GMT) Full text and rfc822 format available.

Message #10 received at 624150-done@bugs.debian.org (full text, mbox):

From: David Prévot <david@tilapin.org>
To: 624150-done@bugs.debian.org
Subject: Re: Bug#624150: www.debian.org: Please use iso-codes to translate language and country names
Date: Wed, 27 Apr 2011 13:34:47 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Le 25/04/2011 23:04, David Prévot a écrit :

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

Thanks to Stephen Gran who took care quickly of [rt.debian.org #3132], I
just applied the patch, and will continue to get rid of other use of
language_names.wml when possible.

Regards

David

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJNuFO1AAoJELgqIXr9/gnyzUwP/0U8oK8on3g6rC0u/0HaV/bs
TP6jGYvVyhYM8HzGoIWm1RFAWShCDas3G8/Z9qAdoqQngDWTTRmuBC0fCojd11An
ixbgV/Wm1TnCrdd8LyhGyd597PlPiHriBNaRxjwGz+ftKtQmO2P3oQbQNkinjYu5
3dxpUa6l928iM7B8IbUQ9lMq2vbqS6BTZt8IWioGzI1YLIA25zEoJeM2B/ZDVdJP
kRQmsaafnqPB/iuAmtGlzTrYJYiBNLCu3vWWK0kF5MgUvhi0MT9inb1ezLgU1NFX
QlJYkHs9CqiJajj6CfHbCTjMLDxI2H/CMbVEFGBm7m8LDwxR8xpi+0ZR5CPKGAZz
ASbnVBcsbPHx1UtdizFzxRx7pR0vQRTFO4rN5xkmEjhXbeJKA5JOs/QYXh20NWTu
20idGBkD+1CpQq31v8GJhD0R7RY+v7dx5d+LsRPW1pGsRPundR2gBBgKQW4HJC+V
nQcWeCsuJ0WKU80IaICxE9LwOxTVfCi/rPkfezZuOId25Up5+OgR/ETdWMargRXZ
FXSgraoVyHVVhMWHwjGQH9dsgjrVhRwCQAKoL2BY0LX0qTMFCK3jXrCPCDs9Audl
kZ8/SONwav0aTUqbVEJvlssHpPwSu+JevFbzhJXmDSb7YLojzGm6+FsjrbXCMNJq
T8/1KyE5JhNfHw2MqHc2
=0Auj
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Thu, 26 May 2011 07:36:26 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 14:56:11 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.