[html-formfu] UTF-8 double encoding with HTML::FormFu

Immofrance - Green-Acres admin at immofrance.com
Tue Apr 29 11:10:27 BST 2008


Thanks! I finally have it working.

Using po files without the proper header below was my problem. Correct conf for me is using http://search.cpan.org/dist/HTML-FormFu/lib/HTML/FormFu/Manual/Unicode.pod and the following:


Po file in lib/MyApp/I18N/en.po
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"


#: root/src/edit.tt:6
msgid "J'ai %quant(%1,société,sociétés)"
msgstr "I have %quant(%1,company,companies)"


-------------
myapp.yml

---
name: MyApp


'Controller::HTML::FormFu':
  localize_from_context: 1
  languages_from_context: 1
  constructor:
    tt_args:
      ENCODING: UTF-8

'View::HTML':
  ENCODING: UTF-8

'Plugin::I18N':
  maketext_options:
    Decode: 1
    Auto: 1

--------------
lib/MyApp.pm

use Catalyst qw/-Debug ConfigLoader Static::Simple Unicode I18N/;

-------
root/lib/config/main # For TTSite


   MACRO loc(text, args) BLOCK;
       Catalyst.localize(text, args);
   END;

-------
In controller:
use utf8;

(... ) $c->stash->{my_text} = $c->loc("J'ai [quant,_1,société,sociétés]",10); (...)

----
In template.tt2
[% my_text %]<br />
[% loc("J'ai [quant,_1,société,sociétés]",1) %]<br />
[% loc("J'ai [quant,_1,société,sociétés]",3) %]<br />

Output with browser language as english:
I have 10 companies
I have 1 company
I have 3 companies


-----Message d'origine-----
De : vti [mailto:viacheslav.t at gmail.com] 
Envoyé : lundi 28 avril 2008 23:45
À : html-formfu at lists.rawmode.org
Objet : Re: [html-formfu] UTF-8 double encoding with HTML::FormFu

Immofrance - Green-Acres(admin at immofrance.com)@Mon, Apr 28, 2008 at 05:44:23PM +0200:
> Would you have a full sample app running that you could provide ? It would be
> really helpful for anyone that really wants to do I18N with Catalyst and
> Formfu.

You can look at mine http://code.google.com/p/godcore. It is UTF-8 everywhere...

-- 
vti -- Viacheslav Tikhanovskii

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu at lists.rawmode.org
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu






More information about the HTML-FormFu mailing list