summaryrefslogtreecommitdiff
path: root/lib/Locale/Maketext
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-06-17 09:57:14 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-06-17 09:57:14 +0000
commit1189c2455625fa7630a612bc6b2c4ce3a215a4bc (patch)
treeeb400517171d555134dce9d9edf2a800f310e23f /lib/Locale/Maketext
parent8000a3fa7bb45bbd1016a26c76a82389badfc8ce (diff)
downloadperl-1189c2455625fa7630a612bc6b2c4ce3a215a4bc.tar.gz
Upgrade to Locale::Maketext 1.09
p4raw-id: //depot/perl@22942
Diffstat (limited to 'lib/Locale/Maketext')
-rw-r--r--lib/Locale/Maketext/ChangeLog12
-rw-r--r--lib/Locale/Maketext/README6
-rw-r--r--lib/Locale/Maketext/t/00about.t29
-rw-r--r--lib/Locale/Maketext/t/01_about_verbose.t87
-rw-r--r--lib/Locale/Maketext/t/03http.t102
-rw-r--r--lib/Locale/Maketext/t/10_make.t (renamed from lib/Locale/Maketext/t/01make.t)0
-rw-r--r--lib/Locale/Maketext/t/20_get.t (renamed from lib/Locale/Maketext/t/02get.t)3
-rw-r--r--lib/Locale/Maketext/t/40_super.t (renamed from lib/Locale/Maketext/t/04super.t)13
-rw-r--r--lib/Locale/Maketext/t/50_super.t (renamed from lib/Locale/Maketext/t/05super.t)0
-rw-r--r--lib/Locale/Maketext/t/60_super.t (renamed from lib/Locale/Maketext/t/06super.t)0
-rw-r--r--lib/Locale/Maketext/t/90_utf8.t (renamed from lib/Locale/Maketext/t/90utf8.t)0
11 files changed, 109 insertions, 143 deletions
diff --git a/lib/Locale/Maketext/ChangeLog b/lib/Locale/Maketext/ChangeLog
index 96556f4118..9256134c5e 100644
--- a/lib/Locale/Maketext/ChangeLog
+++ b/lib/Locale/Maketext/ChangeLog
@@ -1,6 +1,16 @@
Revision history for Perl suite Locale::Maketext
- Time-stamp: "2004-01-19 15:11:56 AST"
+ Time-stamp: "2004-03-30 21:38:07 AST"
+2004-03-30 Sean M. Burke sburke@cpan.org
+ * Release 1.09:
+
+ * Moved the language-preference-detecting code into new module
+ I18N::LangTags::Detect.
+
+ Thanks to Autrijus Tang for catching some errors in the dist!
+
+
+
2004-01-19 Sean M. Burke sburke@cpan.org
* Release 1.08:
diff --git a/lib/Locale/Maketext/README b/lib/Locale/Maketext/README
index 3174ad1334..55a2ff73e8 100644
--- a/lib/Locale/Maketext/README
+++ b/lib/Locale/Maketext/README
@@ -1,5 +1,5 @@
README for Locale::Maketext
- Time-stamp: "2004-01-11 18:36:09 AST"
+ Time-stamp: "2004-03-30 16:02:27 AST"
Locale::Maketext
@@ -8,10 +8,6 @@ localization and inheritance-based lexicons, as described in my
article in The Perl Journal #13 (a corrected version of which appears
in this dist).
-This is a complete rewrite from the basically undocumented 0.x
-versions.
-
-
PREREQUISITES
diff --git a/lib/Locale/Maketext/t/00about.t b/lib/Locale/Maketext/t/00about.t
deleted file mode 100644
index 9b2fc85999..0000000000
--- a/lib/Locale/Maketext/t/00about.t
+++ /dev/null
@@ -1,29 +0,0 @@
-
-require 5;
-use Test;
-BEGIN { plan tests => 1; }
-use Locale::Maketext 1.01;
-
-print "#\n#\n",
- "# Locale::Maketext v$Locale::Maketext::VERSION\n",
- "# I18N::LangTags v", $I18N::LangTags::VERSION || "?", "\n",
- "#\n#\n",
-;
-
-print "# Running under perl version $] for $^O",
- (chr(65) eq 'A') ? "\n" : " in a non-ASCII world\n";
-
-print "# Win32::BuildNumber ", &Win32::BuildNumber(), "\n"
- if defined(&Win32::BuildNumber) and defined &Win32::BuildNumber();
-
-print "# MacPerl verison $MacPerl::Version\n"
- if defined $MacPerl::Version;
-
-printf
- "# Current time local: %s\n# Current time GMT: %s\n",
- scalar( gmtime($^T)), scalar(localtime($^T));
-
-print "# Using Test.pm v", $Test::VERSION || "?", "\n";
-
-ok 1;
-
diff --git a/lib/Locale/Maketext/t/01_about_verbose.t b/lib/Locale/Maketext/t/01_about_verbose.t
new file mode 100644
index 0000000000..1e268d2a4e
--- /dev/null
+++ b/lib/Locale/Maketext/t/01_about_verbose.t
@@ -0,0 +1,87 @@
+
+require 5;
+# Time-stamp: "2004-03-30 17:02:53 AST"
+
+# Summary of, well, things.
+
+use Test;
+BEGIN {plan tests => 2};
+
+ok 1;
+
+use Locale::Maketext;
+
+#chdir "t" if -e "t";
+
+{
+ my @out;
+ push @out,
+ "\n\nPerl v",
+ defined($^V) ? sprintf('%vd', $^V) : $],
+ " under $^O ",
+ (defined(&Win32::BuildNumber) and defined &Win32::BuildNumber())
+ ? ("(Win32::BuildNumber ", &Win32::BuildNumber(), ")") : (),
+ (defined $MacPerl::Version)
+ ? ("(MacPerl version $MacPerl::Version)") : (),
+ "\n"
+ ;
+
+ # Ugly code to walk the symbol tables:
+ my %v;
+ my @stack = (''); # start out in %::
+ my $this;
+ my $count = 0;
+ my $pref;
+ while(@stack) {
+ $this = shift @stack;
+ die "Too many packages?" if ++$count > 1000;
+ next if exists $v{$this};
+ next if $this eq 'main'; # %main:: is %::
+
+ #print "Peeking at $this => ${$this . '::VERSION'}\n";
+
+ if(defined ${$this . '::VERSION'} ) {
+ $v{$this} = ${$this . '::VERSION'}
+ } elsif(
+ defined *{$this . '::ISA'} or defined &{$this . '::import'}
+ or ($this ne '' and grep defined *{$_}{'CODE'}, values %{$this . "::"})
+ # If it has an ISA, an import, or any subs...
+ ) {
+ # It's a class/module with no version.
+ $v{$this} = undef;
+ } else {
+ # It's probably an unpopulated package.
+ ## $v{$this} = '...';
+ }
+
+ $pref = length($this) ? "$this\::" : '';
+ push @stack, map m/^(.+)::$/ ? "$pref$1" : (), keys %{$this . '::'};
+ #print "Stack: @stack\n";
+ }
+ push @out, " Modules in memory:\n";
+ delete @v{'', '[none]'};
+ foreach my $p (sort {lc($a) cmp lc($b)} keys %v) {
+ $indent = ' ' x (2 + ($p =~ tr/:/:/));
+ push @out, ' ', $indent, $p, defined($v{$p}) ? " v$v{$p};\n" : ";\n";
+ }
+ push @out, sprintf "[at %s (local) / %s (GMT)]\n",
+ scalar(gmtime), scalar(localtime);
+ my $x = join '', @out;
+ $x =~ s/^/#/mg;
+ print $x;
+}
+
+print "# Running",
+ (chr(65) eq 'A') ? " in an ASCII world.\n" : " in a non-ASCII world.\n",
+ "#\n",
+;
+
+print "# \@INC:\n", map("# [$_]\n", @INC), "#\n#\n";
+
+print "# \%INC:\n";
+foreach my $x (sort {lc($a) cmp lc($b)} keys %INC) {
+ print "# [$x] = [", $INC{$x} || '', "]\n";
+}
+
+ok 1;
+
diff --git a/lib/Locale/Maketext/t/03http.t b/lib/Locale/Maketext/t/03http.t
deleted file mode 100644
index 98e7207a60..0000000000
--- a/lib/Locale/Maketext/t/03http.t
+++ /dev/null
@@ -1,102 +0,0 @@
-
-use Locale::Maketext;
-
-use Test;
-BEGIN { plan tests => 87 };
-
-my @in = grep m/\S/, split /\n/, q{
-
-[ sv ] sv
-[ en ] en
-[ en fi ] en, fi
-[ en-us ] en-us
-[ en-us ] en-US
-[ en-us ] EN-US
-
-[ en-au en i-klingon en-gb en-us mt-mt mt ja ] EN-au, JA;q=0.14, i-klingon;q=0.83, en-gb;q=0.71, en-us;q=0.57, mt-mt;q=0.43, mt;q=0.29, en;q=0.86
-[ en-au en i-klingon en-gb en-us mt-mt mt tli ja ] EN-au, tli;q=0.201, JA;q=0.14, i-klingon;q=0.83, en-gb;q=0.71, en-us;q=0.57, mt-mt;q=0.43, mt;q=0.29, en;q=0.86
-[ en-au en en-gb en-us ja ] en-au, ja;q=0.20, en-gb;q=0.60, en-us;q=0.40, en;q=0.80
-
-[ en-au en en-gb en-us mt-mt mt ja ] EN-au, JA;q=0.14, en-gb;q=0.71, en-us;q=0.57, mt-mt;q=0.43, mt;q=0.29, en;q=0.86
-[ en-au en en-gb en-us ja ] en-au, ja;q=0.20, en-gb;q=0.60, en-us;q=0.40, en;q=0.80
-[ en fr ] en;q=1,fr;q=.5
-[ en fr ] en;q=1,fr;q=.99
-[ en ru ko ] en, ru;q=0.7, ko;q=0.3
-[ en ru ko ] en, ru;q=0.7, KO;q=0.3
-[ en-us en ] en-us, en;q=0.50
-[ en fr ] fr ; q = 0.9, en
-[ en fr ] en,fr;q=.90
-[ ru en-uk en fr ] ru, en-UK;q=0.5, en;q=0.3, fr;q=0.1
-[ en-us fr es-mx ] en-us,fr;q=0.7,es-mx;q=0.3
-[ en-us en ] en-us, en;q=0.50
-
-[ da en-gb en ] da, en-gb;q=0.8, en;q=0.7
-[ da en-gb en ] da, en;q=0.7, en-gb;q=0.8
-[ da en-gb en ] da, en-gb;q=0.8, en;q=0.7
-[ da en-gb en ] da,en;q=0.7,en-gb;q=0.8
-[ da en-gb en ] da, en-gb ; q=0.8, en ; q=0.7
-[ da en-gb en ] da , en-gb ; q = 0.8 , en ; q =0.7
-[ da en-gb en ] da (yup, Danish) , en-gb ; q = 0.8 , en ; q =0.7
-
-[ no dk en-uk en-us ] en-UK;q=0.7, en-US;q=0.6, no;q=1.0, dk;q=0.8
-[ no dk en-uk en-us ] en-US;q=0.6, en-UK;q=0.7, no;q=1.0, dk;q=0.8
-[ no dk en-uk en-us ] en-UK;q=0.7, no;q=1.0, en-US;q=0.6, dk;q=0.8
-[ no dk en-uk en-us ] en-UK;q=0.7, no;q=1.0, dk;q=0.8, en-US;q=0.6
-
-[ fi en ] fi;q=1, en;q=0.2
-[ de-de de en en-us en-gb ] de-DE, de;q=0.80, en;q=0.60, en-US;q=0.40, en-GB;q=0.20
-[ ru ] ru; q=1, *; q=0.1
-[ ru en ] ru, en; q=0.1
-[ ja en ] ja,en;q=0.5
-[ en ] en; q=1.0
-[ ja ] ja; q=1.0
-[ ja ] ja; q=1.0
-[ en ja ] en; q=0.5, ja; q=0.5
-[ fr-ca fr en ] fr-ca, fr;q=0.8, en;q=0.7
-[ NIX ] NIX
-};
-
-foreach my $in (@in) {
- $in =~ s/^\s*\[([^\]]+)\]\s*//s or die "Bad input: $in";
- my @should = do { my $x = $1; $x =~ m/(\S+)/g };
-
- if($in eq 'NIX') { $in = ''; @should = (); }
-
- local $ENV{'HTTP_ACCEPT_LANGUAGE'};
-
- foreach my $modus (
- sub {
- print "# Testing with arg...\n";
- $ENV{'HTTP_ACCEPT_LANGUAGE'} = 'PLORK';
- return $_[0];
- },
- sub {
- print "# Testing wath HTTP_ACCEPT_LANGUAGE...\n";
- $ENV{'HTTP_ACCEPT_LANGUAGE'} = $_[0];
- return();
- },
- ) {
- my @args = &$modus($in);
-
- # ////////////////////////////////////////////////////
- my @out = Locale::Maketext->_http_accept_langs(@args);
- # \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
-
- if(
- @out == @should
- and lc( join "\e", @out ) eq lc( join "\e", @should )
- ) {
- print "# Happily got [@out] from [$in]\n";
- ok 1;
- } else {
- ok 0;
- print "#Got: [@out]\n",
- "# but wanted: [@should]\n",
- "# < \"$in\"\n#\n";
- }
- }
-}
-
-print "#\n#\n# Bye-bye!\n";
-ok 1;
-
diff --git a/lib/Locale/Maketext/t/01make.t b/lib/Locale/Maketext/t/10_make.t
index d9352d0340..d9352d0340 100644
--- a/lib/Locale/Maketext/t/01make.t
+++ b/lib/Locale/Maketext/t/10_make.t
diff --git a/lib/Locale/Maketext/t/02get.t b/lib/Locale/Maketext/t/20_get.t
index 86fd4b20af..c9ad01c738 100644
--- a/lib/Locale/Maketext/t/02get.t
+++ b/lib/Locale/Maketext/t/20_get.t
@@ -43,7 +43,10 @@ ok $ENV{'SWUZ'}, 'KLORTHO HOOBOY';
delete $ENV{'MYORP'};
delete $ENV{'SWUZ'};
+
print "# Test LANG...\n";
+$ENV{'LC_ALL'} = '';
+$ENV{'LC_MESSAGES'} = '';
$ENV{'REQUEST_METHOD'} = '';
$ENV{'LANG'} = 'Eu_MT';
$ENV{'LANGUAGE'} = '';
diff --git a/lib/Locale/Maketext/t/04super.t b/lib/Locale/Maketext/t/40_super.t
index 39df0bedbb..388326c52d 100644
--- a/lib/Locale/Maketext/t/04super.t
+++ b/lib/Locale/Maketext/t/40_super.t
@@ -1,4 +1,5 @@
+# Time-stamp: "2004-03-30 18:02:24 AST"
#sub Locale::Maketext::DEBUG () {10}
use Locale::Maketext;
@@ -15,22 +16,22 @@ my @in = grep m/\S/, split /[\n\r]/, q{
pt-br => pt-br pt
pt-br fr => pt-br fr pt
- pt-br fr pt => pt-br fr pt pt
- pt-br fr pt de => pt-br fr pt de pt
- de pt-br fr pt => de pt-br fr pt pt
+ pt-br fr pt => pt-br fr pt
+ pt-br fr pt de => pt-br fr pt de
+ de pt-br fr pt => de pt-br fr pt
de pt-br fr => de pt-br fr pt
hai pt-br fr => hai pt-br fr pt
# Now test multi-part complicateds:
pt-br-janeiro fr => pt-br-janeiro fr pt-br pt
pt-br-janeiro de fr => pt-br-janeiro de fr pt-br pt
-pt-br-janeiro de pt fr => pt-br-janeiro de pt fr pt-br pt
+pt-br-janeiro de pt fr => pt-br-janeiro de pt fr pt-br
ja pt-br-janeiro fr => ja pt-br-janeiro fr pt-br pt
ja pt-br-janeiro de fr => ja pt-br-janeiro de fr pt-br pt
-ja pt-br-janeiro de pt fr => ja pt-br-janeiro de pt fr pt-br pt
+ja pt-br-janeiro de pt fr => ja pt-br-janeiro de pt fr pt-br
-pt-br-janeiro de pt-br fr => pt-br-janeiro de pt-br fr pt-br pt pt
+pt-br-janeiro de pt-br fr => pt-br-janeiro de pt-br fr pt
# an odd case, since we don't filter for uniqueness in this sub
};
diff --git a/lib/Locale/Maketext/t/05super.t b/lib/Locale/Maketext/t/50_super.t
index a5814165ce..a5814165ce 100644
--- a/lib/Locale/Maketext/t/05super.t
+++ b/lib/Locale/Maketext/t/50_super.t
diff --git a/lib/Locale/Maketext/t/06super.t b/lib/Locale/Maketext/t/60_super.t
index 922275d179..922275d179 100644
--- a/lib/Locale/Maketext/t/06super.t
+++ b/lib/Locale/Maketext/t/60_super.t
diff --git a/lib/Locale/Maketext/t/90utf8.t b/lib/Locale/Maketext/t/90_utf8.t
index 96731e2b19..96731e2b19 100644
--- a/lib/Locale/Maketext/t/90utf8.t
+++ b/lib/Locale/Maketext/t/90_utf8.t