r1463 - in packages/libi18n-acceptlanguage-perl/branches/upstream/current: . lib/I18N t

Frank Lichtenheld djpig at costa.debian.org
Sun Nov 6 22:20:38 UTC 2005


Author: djpig
Date: 2005-11-06 22:20:37 +0000 (Sun, 06 Nov 2005)
New Revision: 1463

Modified:
   packages/libi18n-acceptlanguage-perl/branches/upstream/current/Changes
   packages/libi18n-acceptlanguage-perl/branches/upstream/current/META.yml
   packages/libi18n-acceptlanguage-perl/branches/upstream/current/lib/I18N/AcceptLanguage.pm
   packages/libi18n-acceptlanguage-perl/branches/upstream/current/t/01simple.t
   packages/libi18n-acceptlanguage-perl/branches/upstream/current/t/02quality.t
Log:
Load /tmp/tmp.UCX0vM/libi18n-acceptlanguage-perl-1.04 into
packages/libi18n-acceptlanguage-perl/branches/upstream/current.


Modified: packages/libi18n-acceptlanguage-perl/branches/upstream/current/Changes
===================================================================
--- packages/libi18n-acceptlanguage-perl/branches/upstream/current/Changes	2005-11-03 16:15:49 UTC (rev 1462)
+++ packages/libi18n-acceptlanguage-perl/branches/upstream/current/Changes	2005-11-06 22:20:37 UTC (rev 1463)
@@ -1,3 +1,18 @@
+2005-04-11	Christian Gilmore <cag at us.ibm.com>
+
+	o Corrected secondary matching bug that errantly overwrote the
+	  first match.Added tests. Bug and fix reported by Jacques Supcik
+	  <jacques at supcik.net>.
+	o Corrected secondary list creation bug that did not put
+	  supported languages without locales into the list.
+	o Made release 1.04.
+
+2004-05-14	Christian Gilmore <cag at us.ibm.com>
+
+	o Updated documentation surrounding use of strict. Change
+	  suggested by Mark Fuller <mark.fuller at earthlink.net>.
+	o Made release 1.03.
+
 2004-02-11	Christian Gilmore <cag at us.ibm.com>
 
 	o Now return defaultLanguage from accepts method when input is

Modified: packages/libi18n-acceptlanguage-perl/branches/upstream/current/META.yml
===================================================================
--- packages/libi18n-acceptlanguage-perl/branches/upstream/current/META.yml	2005-11-03 16:15:49 UTC (rev 1462)
+++ packages/libi18n-acceptlanguage-perl/branches/upstream/current/META.yml	2005-11-06 22:20:37 UTC (rev 1463)
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         I18N-AcceptLanguage
-version:      1.02
+version:      1.04
 version_from: lib/I18N/AcceptLanguage.pm
 installdirs:  site
 requires:

Modified: packages/libi18n-acceptlanguage-perl/branches/upstream/current/lib/I18N/AcceptLanguage.pm
===================================================================
--- packages/libi18n-acceptlanguage-perl/branches/upstream/current/lib/I18N/AcceptLanguage.pm	2005-11-03 16:15:49 UTC (rev 1462)
+++ packages/libi18n-acceptlanguage-perl/branches/upstream/current/lib/I18N/AcceptLanguage.pm	2005-11-06 22:20:37 UTC (rev 1463)
@@ -1,4 +1,4 @@
-# $Id: AcceptLanguage.pm,v 1.7 2004/02/11 20:51:02 cgilmore Exp $
+# $Id: AcceptLanguage.pm,v 1.8 2004/05/14 21:40:03 cgilmore Exp $
 #
 # Author          : Christian Gilmore
 # Created On      : Wed Sep 25 17:10:19 CDT 2002
@@ -268,7 +268,7 @@
 
 
 # Global variables
-$VERSION = '1.02';
+$VERSION = '1.04';
 
 
 ###############################################################################
@@ -365,7 +365,7 @@
     print "Added language $language (lower-cased) to supported hash\n"
       if $acceptor->debug();
     $supportedLanguages{lc($language)} = $language;
-    if ($language =~ /^([^-]+)-/) {
+    if ($language =~ /^([^-]+)-?/) {
       print "Added language $1 (lower-cased) to secondary hash\n"
 	if $acceptor->debug();
       $secondaryLanguages{lc($1)} = $language;
@@ -394,13 +394,15 @@
       return $supportedLanguages{$tag->{lclanguage}};
     } elsif (!($acceptor->strict()) &&
 	     $tag->{lclanguage} =~ /^([^-]+)-/ &&
-	     exists($secondaryLanguages{$1})) {
+	     exists($secondaryLanguages{$1}) &&
+	     $secondaryMatch eq '') {
       # Client en-gb eq server en-us
       print "Setting supported secondaryMatch of $1 for ", $tag->{lclanguage}, "\n"
 	if $acceptor->debug();
       $secondaryMatch = $secondaryLanguages{$1};
     } elsif ($tag->{lclanguage} =~ /^([^-]+)-/ &&
-	     exists($supportedLanguages{$1})) {
+	     exists($secondaryLanguages{$1}) &&
+	     $secondaryMatch eq '') {
       # Client en-us eq server en
       print "Setting secondary secondaryMatch of $1 for ", $tag->{lclanguage}, "\n"
 	if $acceptor->debug();
@@ -509,8 +511,9 @@
 conforms to the protocol specification. When set to 0, the software
 will perform a secondary, aggressive language match regardless of
 country (ie, a client asking for only en-gb will get back en-us if the
-server does not accept en-gb or en but does accept en-us). The value
-of strict defaults to 1.
+server does not accept en-gb or en but does accept en-us). The last
+matching language in the supported languages list will be chosen. The
+value of strict defaults to 1.
 
 =back
 

Modified: packages/libi18n-acceptlanguage-perl/branches/upstream/current/t/01simple.t
===================================================================
--- packages/libi18n-acceptlanguage-perl/branches/upstream/current/t/01simple.t	2005-11-03 16:15:49 UTC (rev 1462)
+++ packages/libi18n-acceptlanguage-perl/branches/upstream/current/t/01simple.t	2005-11-06 22:20:37 UTC (rev 1463)
@@ -16,6 +16,7 @@
 ok( $t1->accepts('en', [( 'en-us' )]) eq 'en-us' );
 ok( $t1->accepts('en-gb', [( 'en-us' )]) eq '' );
 ok( $t1->accepts('ja', [( 'en' )]) eq '' );
+ok( $t1->accepts('da,en-gb,fr-ch', [( 'en', 'de', 'fr', 'it' )]) eq 'en' );
 
 ###############################################################################
 # Basic tests with default language 

Modified: packages/libi18n-acceptlanguage-perl/branches/upstream/current/t/02quality.t
===================================================================
--- packages/libi18n-acceptlanguage-perl/branches/upstream/current/t/02quality.t	2005-11-03 16:15:49 UTC (rev 1462)
+++ packages/libi18n-acceptlanguage-perl/branches/upstream/current/t/02quality.t	2005-11-06 22:20:37 UTC (rev 1463)
@@ -16,3 +16,4 @@
 ok( $t1->accepts('en-gb;q=1,en;q=0.2', [( 'en-us', 'en-gb' )]) eq 'en-gb' );
 ok( $t1->accepts('en-gb;q=1,en;q=0.2', [( 'en-us', 'en' )]) eq 'en' );
 ok( $t1->accepts('en-gb;q=1,en;q=0.9,ja;q=0.8', [( 'en-us', 'ja' )]) eq 'en-us' );
+ok( $t1->accepts('da,en-gb;q=0.8,fr-ch;q=0.7', [( 'en', 'de', 'fr', 'it' )]) eq 'en' );




More information about the Pkg-perl-cvs-commits mailing list