Tanktalus has asked for the wisdom of the Perl Monks concerning the following question:

As my first assignment in my new job ramps up, one task I've taken on is to resolve L10N issues. From the looks of things, I think Locale::Maketext looks to have addressed 90%+ of the issues (though if they could have packaged in base classes that help with double-byte, or other locale, issues, that'd have been great - they seemed to know about some issues, just leaving handling them as excersises for the users). One substantial piece left unresolved is the creation of the base language class (usually English). They provide an _AUTO option, which looks useful, until I found out that, well, it didn't write the updates back to the English module, which would make it harder to create the modules for the other languages.

Also missing is the "delta" - that is, merging those keys, but with empty values, into the other languages' modules.

The first thing popping into my head would be to use something like PPI to look for the maketext calls and extract the first parameter and then use that to update all the language files (as both key and value for English, and just key with empty value for other languages). Manually updating English is already annoying, so that'd actually be the second thing that popped into my head, and it doesn't actually resolve the other-languages issue to send to the translators.

I'm wondering if anyone else has dealt with this already, and what approach you took? Is "use utf8;" required at the top of these files?

Replies are listed 'Best First'.
Re: Localisation and Locale::Maketext
by phenom (Chaplain) on Dec 22, 2009 at 13:47 UTC
    I have no experience with Locale::Maketext, but have had good luck using the following:
    use encoding 'utf8'; use POSIX qw/locale_h/; use Locale::gettext; textdomain('program-name'); setlocale( LC_MESSAGES, '' ); bind_textdomain_codeset( 'program-name', 'UTF-8' );
    Hope this helps.
      Geez, downvoted! That's what I get for not posting in awhile, I guess.