[Bps-public-commit] Locale-Maketext-Simple branch, master, updated. f4282e1e468a1a62095e25a43e25fa8e7b44d776

jesse jesse at bestpractical.com
Tue Jul 7 14:30:11 EDT 2009


The branch, master has been updated
       via  f4282e1e468a1a62095e25a43e25fa8e7b44d776 (commit)
       via  0bc533b25c493efd1deda0ae7abd1129cf8954ca (commit)
       via  e3b5145aefe7530454d37a09a9aeb3e022ef74dc (commit)
       via  987b1cf01a56bf4941030f453596983c27627efb (commit)
       via  cafa15ec43fb8ba7ed8ad7c4e8ea198fd38cc196 (commit)
       via  04a8fd2372c435fa3ab2afaff6b7e1e4da33dce6 (commit)
      from  06559dd1c748e31a0b9a55a6b5e5e1a6bc456d0e (commit)

Summary of changes:
 .shipit                          |   10 ++++++++++
 Changes                          |    8 ++++++++
 MANIFEST.SKIP                    |   11 +++++++++++
 Makefile.PL                      |    2 +-
 README                           |    4 ++--
 lib/Locale/Maketext/Simple.pm    |   17 ++++++++++-------
 t/1-basic.t                      |    6 +++---
 t/2-load_po_without_i_default.t  |   20 ++++++++++++++++++++
 t/3-load_po_with_i_default.t     |   21 +++++++++++++++++++++
 t/po_with_i_default/en.po        |   30 ++++++++++++++++++++++++++++++
 t/po_with_i_default/fr.po        |   30 ++++++++++++++++++++++++++++++
 t/po_with_i_default/i_default.po |   30 ++++++++++++++++++++++++++++++
 t/po_without_i_default/en.po     |   30 ++++++++++++++++++++++++++++++
 t/po_without_i_default/fr.po     |   30 ++++++++++++++++++++++++++++++
 14 files changed, 236 insertions(+), 13 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 .shipit
 create mode 100644 MANIFEST.SKIP
 create mode 100755 t/2-load_po_without_i_default.t
 create mode 100755 t/3-load_po_with_i_default.t
 create mode 100644 t/po_with_i_default/en.po
 create mode 100644 t/po_with_i_default/fr.po
 create mode 100644 t/po_with_i_default/i_default.po
 create mode 100644 t/po_without_i_default/en.po
 create mode 100644 t/po_without_i_default/fr.po

- Log -----------------------------------------------------------------
commit 04a8fd2372c435fa3ab2afaff6b7e1e4da33dce6
Author: t0m <bobtfish at bobtfish.net>
Date:   Mon Jul 6 22:22:07 2009 +0100

    Require known good version of Module::Install

diff --git a/Makefile.PL b/Makefile.PL
index 6d73b4d..d6557f9 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use inc::Module::Install;
+use inc::Module::Install 0.68;
 
 name	    'Locale-Maketext-Simple';
 license     'MIT';

commit cafa15ec43fb8ba7ed8ad7c4e8ea198fd38cc196
Author: t0m <bobtfish at bobtfish.net>
Date:   Mon Jul 6 22:26:52 2009 +0100

    Add patch from RT#47609 from Ton Voon as I really want this functionality also

diff --git a/Changes b/Changes
index c756bd8..aef6b14 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+
+* Ton Voon, from Opsera Limited contributed the ability to have the IANA
+  defined i-default language, for use as a fallback when arbitrary message keys,
+  rather than English phrases are being used.
+
 [Changes for 0.18 - 2006-09-08]
 
 * At the request of Steve Hay, this module is now available under the
diff --git a/lib/Locale/Maketext/Simple.pm b/lib/Locale/Maketext/Simple.pm
index 63c2d5f..6dc1633 100644
--- a/lib/Locale/Maketext/Simple.pm
+++ b/lib/Locale/Maketext/Simple.pm
@@ -46,6 +46,10 @@ This module is a simple wrapper around B<Locale::Maketext::Lexicon>,
 designed to alleviate the need of creating I<Language Classes> for
 module authors.
 
+The language used is chosen from the loc_lang call. If a lookup is not
+possible, the i-default language will be used. If the lookup is not in the
+i-default language, then the key will be returned.
+
 If B<Locale::Maketext::Lexicon> is not present, it implements a
 minimal localization function by simply interpolating C<[_1]> with
 the first argument, C<[_2]> with the second, etc.  Interpolated
@@ -146,19 +150,19 @@ sub load_loc {
     eval "
 	package $pkg;
 	use base 'Locale::Maketext';
-        %${pkg}::Lexicon = ( '_AUTO' => 1 );
 	Locale::Maketext::Lexicon->import({
 	    'i-default' => [ 'Auto' ],
 	    '*'	=> [ Gettext => \$pattern ],
 	    _decode => \$decode,
 	    _encoding => \$encoding,
 	});
+	*${pkg}::Lexicon = \\%${pkg}::i_default::Lexicon;
 	*tense = sub { \$_[1] . ((\$_[2] eq 'present') ? 'ing' : 'ed') }
 	    unless defined &tense;
 
 	1;
     " or die $@;
-    
+
     my $lh = eval { $pkg->get_handle } or return;
     my $style = lc($args{Style});
     if ($style eq 'maketext') {
@@ -193,7 +197,6 @@ sub load_loc {
 
     return $Loc{$pkg}, sub {
 	$lh = $pkg->get_handle(@_);
-	$lh = $pkg->get_handle(@_);
     };
 }
 
@@ -205,7 +208,7 @@ sub default_loc {
 	    my $str = shift;
             $str =~ s{((?<!~)(?:~~)*)\[_([1-9]\d*|\*)\]}
                      {$1%$2}g;
-            $str =~ s{((?<!~)(?:~~)*)\[([A-Za-z#*]\w*),([^\]]+)\]} 
+            $str =~ s{((?<!~)(?:~~)*)\[([A-Za-z#*]\w*),([^\]]+)\]}
                      {"$1%$2(" . _escape($3) . ')'}eg;
 	    _default_gettext($str, @_);
 	};
diff --git a/t/2-load_po_without_i_default.t b/t/2-load_po_without_i_default.t
new file mode 100755
index 0000000..2587ce5
--- /dev/null
+++ b/t/2-load_po_without_i_default.t
@@ -0,0 +1,20 @@
+use strict;
+use Test::More;
+use FindBin qw($Bin);
+
+use Locale::Maketext::Simple (
+	Path => "$Bin/po_without_i_default",
+	Style => "gettext",
+);
+ 
+plan tests => 5;
+
+loc_lang("en");
+is(loc("Not a lexicon key"), "Not a lexicon key", "Not a lexicon key");
+is(loc("I have got %1 alerts", 65), "I have got 65 alerts", "Got auto key" );
+is(loc("I have acknowledged %1 alerts", 83), "Yo dude, I've been working on these 83 alerts", "Got translation");
+
+loc_lang("fr");
+is(loc("system.messages.arbitrary.unique.lexicon.key"), "system.messages.arbitrary.unique.lexicon.key", "No translation" );
+is(loc("I have got %1 alerts", "red"), "Mon Francais red, c'est terrible", "French translated" );
+
diff --git a/t/3-load_po_with_i_default.t b/t/3-load_po_with_i_default.t
new file mode 100755
index 0000000..f8a58c5
--- /dev/null
+++ b/t/3-load_po_with_i_default.t
@@ -0,0 +1,21 @@
+use strict;
+use Test::More;
+use FindBin qw($Bin);
+
+use Locale::Maketext::Simple (
+	Path => "$Bin/po_with_i_default",
+	Style => "gettext",
+);
+ 
+plan tests => 6;
+
+loc_lang("en");
+is(loc("Not a lexicon key"), "Not a lexicon key", "Not a lexicon key");
+is(loc("I have got %1 alerts", "hot"), "Maybe it's because I'm a hot Londoner, that I love London tawn", "Got auto key" );
+is(loc("I have acknowledged %1 alerts", 83), "Yo dude, I've been working on these 83 alerts", "Got translation still in en");
+is(loc("system.messages.arbitrary.unique.lexicon.key"), "This is the default message", "Used i_default because not set in en");
+
+loc_lang("fr");
+is(loc("system.messages.arbitrary.unique.lexicon.key"), "This is the default message", "Translated from i_default");
+is(loc("I have got %1 alerts", "red"), "Mon Francais red, c'est terrible", "French translated" );
+
diff --git a/t/po_with_i_default/en.po b/t/po_with_i_default/en.po
new file mode 100644
index 0000000..0d80b92
--- /dev/null
+++ b/t/po_with_i_default/en.po
@@ -0,0 +1,30 @@
+# Locale Maketext Simple language translations
+# Copyright (C) All Perl Hackers everywhere
+# Ton Voon <ton.voon at opsera.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Locale Maketext Simple\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2009-06-09 14:10+0000\n"
+"Last-Translator: Ton Voon <ton.voon at opsera.com>\n"
+"Language-Team: English <en at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. $alerts
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have got %1 alerts"
+msgstr ""
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have acknowledged %1 alerts"
+msgstr "Yo dude, I've been working on these %1 alerts"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "system.messages.arbitrary.unique.lexicon.key"
+msgstr ""
+
diff --git a/t/po_with_i_default/fr.po b/t/po_with_i_default/fr.po
new file mode 100644
index 0000000..8ecfbf7
--- /dev/null
+++ b/t/po_with_i_default/fr.po
@@ -0,0 +1,30 @@
+# Locale Maketext Simple language translations
+# Copyright (C) All Perl Hackers everywhere
+# Ton Voon <ton.voon at opsera.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Locale Maketext Simple\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2009-06-09 14:10+0000\n"
+"Last-Translator: Ton Voon <ton.voon at opsera.com>\n"
+"Language-Team: French <fr at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. $alerts
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have got %1 alerts"
+msgstr "Mon Francais %1, c'est terrible"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have acknowledged %1 alerts"
+msgstr ""
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "system.messages.arbitrary.unique.lexicon.key"
+msgstr ""
+
diff --git a/t/po_with_i_default/i_default.po b/t/po_with_i_default/i_default.po
new file mode 100644
index 0000000..7327298
--- /dev/null
+++ b/t/po_with_i_default/i_default.po
@@ -0,0 +1,30 @@
+# Locale Maketext Simple language translations
+# Copyright (C) All Perl Hackers everywhere
+# Ton Voon <ton.voon at opsera.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Locale Maketext Simple\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2009-06-09 14:10+0000\n"
+"Last-Translator: Ton Voon <ton.voon at opsera.com>\n"
+"Language-Team: English <en at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. $alerts
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have got %1 alerts"
+msgstr "Maybe it's because I'm a %1 Londoner, that I love London tawn"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have acknowledged %1 alerts"
+msgstr "In idefault instead of en"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "system.messages.arbitrary.unique.lexicon.key"
+msgstr "This is the default message"
+
diff --git a/t/po_without_i_default/en.po b/t/po_without_i_default/en.po
new file mode 100644
index 0000000..0d80b92
--- /dev/null
+++ b/t/po_without_i_default/en.po
@@ -0,0 +1,30 @@
+# Locale Maketext Simple language translations
+# Copyright (C) All Perl Hackers everywhere
+# Ton Voon <ton.voon at opsera.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Locale Maketext Simple\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2009-06-09 14:10+0000\n"
+"Last-Translator: Ton Voon <ton.voon at opsera.com>\n"
+"Language-Team: English <en at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. $alerts
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have got %1 alerts"
+msgstr ""
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have acknowledged %1 alerts"
+msgstr "Yo dude, I've been working on these %1 alerts"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "system.messages.arbitrary.unique.lexicon.key"
+msgstr ""
+
diff --git a/t/po_without_i_default/fr.po b/t/po_without_i_default/fr.po
new file mode 100644
index 0000000..8ecfbf7
--- /dev/null
+++ b/t/po_without_i_default/fr.po
@@ -0,0 +1,30 @@
+# Locale Maketext Simple language translations
+# Copyright (C) All Perl Hackers everywhere
+# Ton Voon <ton.voon at opsera.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Locale Maketext Simple\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2009-06-09 14:10+0000\n"
+"Last-Translator: Ton Voon <ton.voon at opsera.com>\n"
+"Language-Team: French <fr at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. $alerts
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have got %1 alerts"
+msgstr "Mon Francais %1, c'est terrible"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have acknowledged %1 alerts"
+msgstr ""
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "system.messages.arbitrary.unique.lexicon.key"
+msgstr ""
+

commit 987b1cf01a56bf4941030f453596983c27627efb
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Jul 7 14:26:31 2009 -0400

    Imported http://search.cpan.org/CPAN/authors/id/A/AU/AUDREYT/Locale-Maketext-Simple-0.18.tar.gz as CPAN was not in sync with git

diff --git a/README b/README
index 714e1ce..49e3204 100644
--- a/README
+++ b/README
@@ -16,8 +16,8 @@ Locale::Maketext::Simple uses the standard perl module install process:
 Copyright 2002, 2003, 2004, 2005, 2006 by Audrey Tang <cpan at audreyt.org>.
 
 This software is released under the MIT license cited below.  Additionally,
-when this software is distributed as part of "Perl Kit, Version 5", you may
-also redistribute it and/or modify it under the same terms as Perl itself.
+when this software is distributed with B<Perl Kit, Version 5>, you may also
+redistribute it and/or modify it under the same terms as Perl itself.
 
 * The "MIT" License
 
diff --git a/lib/Locale/Maketext/Simple.pm b/lib/Locale/Maketext/Simple.pm
index 63c2d5f..ddc1c65 100644
--- a/lib/Locale/Maketext/Simple.pm
+++ b/lib/Locale/Maketext/Simple.pm
@@ -312,8 +312,8 @@ Audrey Tang E<lt>cpan at audreyt.orgE<gt>
 Copyright 2003, 2004, 2005, 2006 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
 
 This software is released under the MIT license cited below.  Additionally,
-when this software is distributed as part of "Perl Kit, Version 5", you may
-also redistribute it and/or modify it under the same terms as Perl itself.
+when this software is distributed with B<Perl Kit, Version 5>, you may also
+redistribute it and/or modify it under the same terms as Perl itself.
 
 =head2 The "MIT" License
 
diff --git a/t/1-basic.t b/t/1-basic.t
index da0a4ea..91d033b 100755
--- a/t/1-basic.t
+++ b/t/1-basic.t
@@ -3,9 +3,8 @@ use Test;
 
 BEGIN {
     plan tests => 9;
-    $INC{'main.pm'} = __FILE__;
-#   $INC{'Locale/Maketext/Lexicon.pm'} = __FILE__;
-#   $Locale::Maketext::Lexicon::VERSION = 0;
+    $INC{'Locale/Maketext/Lexicon.pm'} = __FILE__;
+    $Locale::Maketext::Lexicon::VERSION = 0;
 }
 
 use Locale::Maketext::Simple;
@@ -20,6 +19,7 @@ ok(loc("Just [_1] Perl [_2]", qw(another hacker)), "Just another Perl hacker");
 
 ok(loc("Just %1 Perl %2", qw(another hacker)), "Just another Perl hacker");
 ok(loc_lang('fr'));
+ok(loc("Just %quant(%1,Perl hacker)", 1), "Just 1 Perl hacker");
 ok(loc("Just %quant(%1,Perl hacker)", 2), "Just 2 Perl hackers");
 ok(loc("Just %quant(%1,Mad skill,Mad skillz)", 3), "Just 3 Mad skillz");
 ok(loc("Error %tense(%1,present)", 'uninstall'), "Error uninstalling");

commit e3b5145aefe7530454d37a09a9aeb3e022ef74dc
Merge: 987b1cf... cafa15e...
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Jul 7 14:27:02 2009 -0400

    Merge branch 'master' of git://github.com/bobtfish/locale-maketext-simple
    
    * 'master' of git://github.com/bobtfish/locale-maketext-simple:
      Add patch from RT#47609 from Ton Voon as I really want this functionality also
      Require known good version of Module::Install


commit 0bc533b25c493efd1deda0ae7abd1129cf8954ca
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Jul 7 14:28:33 2009 -0400

    updated changes, version dep

diff --git a/Changes b/Changes
index aef6b14..ae70f19 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+[Changes for 0.19 - 2009-07-07]
+
+* Bumped the version dependency to 5.005
 
 * Ton Voon, from Opsera Limited contributed the ability to have the IANA
   defined i-default language, for use as a fallback when arbitrary message keys,
diff --git a/lib/Locale/Maketext/Simple.pm b/lib/Locale/Maketext/Simple.pm
index 5f1e72f..56e4a11 100644
--- a/lib/Locale/Maketext/Simple.pm
+++ b/lib/Locale/Maketext/Simple.pm
@@ -2,7 +2,7 @@ package Locale::Maketext::Simple;
 $Locale::Maketext::Simple::VERSION = '0.18';
 
 use strict;
-use 5.004;
+use 5.005;
 
 =head1 NAME
 

commit f4282e1e468a1a62095e25a43e25fa8e7b44d776
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Jul 7 14:30:04 2009 -0400

    Releng work

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/.shipit b/.shipit
new file mode 100644
index 0000000..44c02c1
--- /dev/null
+++ b/.shipit
@@ -0,0 +1,10 @@
+# auto-generated shipit config file.
+steps = FindVersion, ChangeVersion, CheckChangeLog, DistTest, Commit, Tag, MakeDist, UploadCPAN, Twitter
+
+git.tagpattern = %v
+twitter.config = ~/.twitterrc
+
+# svn.tagpattern = MyProj-%v
+# svn.tagpattern = http://code.example.com/svn/tags/MyProj-%v
+
+# CheckChangeLog.files = ChangeLog, MyProj.CHANGES
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
new file mode 100644
index 0000000..3b88802
--- /dev/null
+++ b/MANIFEST.SKIP
@@ -0,0 +1,11 @@
+TODO
+Makefile
+blib
+pm_to_blib
+.swp$
+~$
+.tmp$
+.bak$
+.git/
+.gitignore$
+.shipit$

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list