Subject: | [PATCH] Locale::Maketext::Lexicon's import broken in subclass usage |
Hi Audrey,
I noticed that in subclass usage, the %Lexicon doesn't get populated
which makes Locale::Maketext to always fallback.
Please, find attached a very short patch against version 0.61 (it's
probably broken since long before).
Bests,
Yann
Subject: | Locale-Maketext-Lexicon-0.61-import.patch |
diff -u -r -N Locale-Maketext-Lexicon-0.61/lib/Locale/Maketext/Lexicon.pm Locale-Maketext-Lexicon-0.61.patched/lib/Locale/Maketext/Lexicon.pm
--- Locale-Maketext-Lexicon-0.61/lib/Locale/Maketext/Lexicon.pm 2006-04-27 06:16:29.000000000 +0200
+++ Locale-Maketext-Lexicon-0.61.patched/lib/Locale/Maketext/Lexicon.pm 2006-06-05 19:30:36.000000000 +0200
@@ -231,7 +231,7 @@
# a hashref with $lang as keys, [$format, $src ...] as values
%entries = %{$_[0]};
}
- elsif (@_ % 2) {
+ elsif (@_ % 2 == 0) {
%entries = ( '' => [ @_ ] );
}
diff -u -r -N Locale-Maketext-Lexicon-0.61/t/99-bug-import-for-subclasses.t Locale-Maketext-Lexicon-0.61.patched/t/99-bug-import-for-subclasses.t
--- Locale-Maketext-Lexicon-0.61/t/99-bug-import-for-subclasses.t 1970-01-01 01:00:00.000000000 +0100
+++ Locale-Maketext-Lexicon-0.61.patched/t/99-bug-import-for-subclasses.t 2006-06-05 19:36:07.000000000 +0200
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+use strict;
+use Test::More tests => 2;
+
+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 main;
+
+################################################################
+
+ok(my $lh = Hello::I18N->get_handle('zh-tw'), 'got handle');
+
+is(
+ $lh->maketext('This is a test'),
+ 'éæ¯æ¸¬è©¦',
+ 'translated'
+);
+