[Rt-commit] r5371 - in Locale-Maketext-Lexicon: . lib/Locale/Maketext

audreyt at bestpractical.com audreyt at bestpractical.com
Thu Jun 15 11:05:04 EDT 2006


Author: audreyt
Date: Thu Jun 15 11:05:03 2006
New Revision: 5371

Added:
   Locale-Maketext-Lexicon/t/99-bug-import-for-subclasses.t
Modified:
   Locale-Maketext-Lexicon/AUTHORS
   Locale-Maketext-Lexicon/Changes
   Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon.pm

Log:
* This be 0.62
* For the longest time, direct import of Locale::Maketext::Lexicon
  from within localization classes (such as MyApp::I18N::zh_tw) was
  untested and broken.  It now works the way described in the SYNOPSIS
  section of the Locale::Maketext::Lexicon documentation.
  Contributed by: Yann Kerherve   

Modified: Locale-Maketext-Lexicon/AUTHORS
==============================================================================
--- Locale-Maketext-Lexicon/AUTHORS	(original)
+++ Locale-Maketext-Lexicon/AUTHORS	Thu Jun 15 11:05:03 2006
@@ -26,4 +26,5 @@
 Tatsuhiko Miyagawa      (MIYAGAWA)
 Thierry Vignaud
 Wei-Hon Chen
+Yann Kerherve           (YANNK)
 Yi Ma Mao               (IMACAT)

Modified: Locale-Maketext-Lexicon/Changes
==============================================================================
--- Locale-Maketext-Lexicon/Changes	(original)
+++ Locale-Maketext-Lexicon/Changes	Thu Jun 15 11:05:03 2006
@@ -1,3 +1,11 @@
+[Changes for 0.62 - 2006-06-15]
+
+* For the longest time, direct import of Locale::Maketext::Lexicon
+  from within localization classes (such as MyApp::I18N::zh_tw) was
+  untested and broken.  It now works the way described in the SYNOPSIS
+  section of the Locale::Maketext::Lexicon documentation.
+  Contributed by: Yann Kerherve
+
 [Changes for 0.61 - 2006-04-27]
 
 * LICENSING CHANGE: This compilation and all individual files in it

Modified: Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon.pm
==============================================================================
--- Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon.pm	(original)
+++ Locale-Maketext-Lexicon/lib/Locale/Maketext/Lexicon.pm	Thu Jun 15 11:05:03 2006
@@ -1,5 +1,5 @@
 package Locale::Maketext::Lexicon;
-$Locale::Maketext::Lexicon::VERSION = '0.61';
+$Locale::Maketext::Lexicon::VERSION = '0.62';
 
 use 5.004;
 use strict;
@@ -10,8 +10,8 @@
 
 =head1 VERSION
 
-This document describes version 0.61 of Locale::Maketext::Lexicon,
-released April 27, 2006.
+This document describes version 0.62 of Locale::Maketext::Lexicon,
+released June 15, 2006.
 
 =head1 SYNOPSIS
 
@@ -231,8 +231,8 @@
         # a hashref with $lang as keys, [$format, $src ...] as values
         %entries = %{$_[0]};
     }
-    elsif (@_ % 2) {
-        %entries = ( '' => [ @_ ] );
+    elsif (@_ % 2 == 0) {
+        %entries = ( '' => [ splice @_, 0, 2 ], @_ );
     }
 
     # expand the wildcard entry

Added: Locale-Maketext-Lexicon/t/99-bug-import-for-subclasses.t
==============================================================================
--- (empty file)
+++ Locale-Maketext-Lexicon/t/99-bug-import-for-subclasses.t	Thu Jun 15 11:05:03 2006
@@ -0,0 +1,48 @@
+#!/usr/bin/perl -w
+use strict;
+use Test::More tests => 4;
+
+package Hello::I18N;
+use base qw/Locale::Maketext/;
+
+package Hello::I18N::zh_tw;
+use base qw/Hello::I18N/;
+use Locale::Maketext::Lexicon ( Gettext => 't/messages.mo', );
+
+package Hello::I18N::bzh_bzh;
+use base qw/Hello::I18N/;
+use Locale::Maketext::Lexicon ( Gettext => \*::DATA, _use_fuzzy => 1);
+
+package main;
+
+ok(my $lh = Hello::I18N->get_handle('zh-tw'), 'got handle');
+
+is(
+	$lh->maketext('This is a test'),
+	'這是測試',
+    'translated'
+);
+
+ok($lh = Hello::I18N->get_handle('bzh_BZH'), 'Gettext - get_handle on DATA again');
+is(
+    eval { $lh->maketext("See you another time!") },
+    "D'ur wech all !",
+    'Gettext - fuzzy recognized: _use_fuzzy has been set'
+);
+
+__DATA__
+msgid ""
+msgstr ""
+"Project-Id-Version: Test App 0.01\n"
+"POT-Creation-Date: 2006-06-13 11:36+0800\n"
+"PO-Revision-Date: 2006-06-13 02:00+0800\n"
+"Last-Translator: <yannk at cpan.org>\n"
+"Language-Team: German <yannk at cpan.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: Hello.pm:16
+#, big, furry, fuzzy
+msgid "See you another time!"
+msgstr "D'ur wech all !"


More information about the Rt-commit mailing list