There are some problems when translating with Catalyst::Plugin::I18N using 
special unicode characters like "æøå".

It got printed (both in console/debugging) and in web browser) as unprintable 
characters (displayed as "?"). Manually changing encoding in Firefox to 
ISO-8859-1 made it look right, but the rest of the page is using UTF-8, so 
this was a no-go solution for me.

The solution I found to this was to change line 65 of Catalyst/Plugin/I18N.pm 
(version 0.06), changed the Decode attribute given 
to "Locale::Maketext::Simple" from 1 to 0.

Any particular reason why Decode was 1?

If Decode=>1 is needed for somebody, this should definitely be a configurable 
option.


Patch attached

-- 
Knut-Olav Hoven
Systemutvikler               mob: +47 986 71 700
Linpro AS                    http://www.linpro.no/
Index: lib/Catalyst/Plugin/I18N.pm
===================================================================
--- lib/Catalyst/Plugin/I18N.pm	(revisjon 390)
+++ lib/Catalyst/Plugin/I18N.pm	(revisjon 397)
@@ -46,6 +46,22 @@
    our %Lexicon = ( 'Hello Catalyst' => 'Hallo Katalysator' );
    1;
 
+=head1 CONFIGURATION
+
+To override the C<Decode> parameter (default to 0), set up configuration in
+your MyApp.pm file like this:
+
+ __PACKAGE__->config(
+    'i18n'  => {
+        'decode'    => 1,
+    },
+ );
+
+or if using YAML configuration file:
+
+ i18n:
+    decode: 1
+
 =head2 EXTENDED METHODS
 
 =head3 setup
@@ -60,9 +76,10 @@
     my $file = "$calldir.pm";
     my $path = $INC{$file};
     $path =~ s#\.pm$#/I18N#;
+    my $decode  = $self->config->{'i18n'}{'decode'} ? 1 : 0;
     eval <<"";
       package $self;
-      import Locale::Maketext::Simple Path => '$path', Export => '_loc', Decode => 1;
+      import Locale::Maketext::Simple Path => '$path', Export => '_loc', Decode => $decode;
 
 
     if ($@) {

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to