libintl-perl

Home -> libintl-perl -> 2004 -> July

 Locale::TextDomain and HTML::Template::Expr 
Login Login Subscribe Subscribe  Date  07/20/04 14:24:41 GMT
 From  Guido Flohr
 Subject  Locale::TextDomain and HTML::Template::Expr
 Previous Thread
 Next Thread
 Start of Thread
 Reference
 Previous Reply
 This Message
 Reply
 Next Reply
Hi Isaac,

Isaac Clerencia wrote:
> Hi Guido, I'm using Locale::TextDomain to i18n'ize a project, the project
> is a web-based interface which uses Perl templates (HTML::Template) and I
> insert the i18n'ized strings in the template like:
> <title><TMPL_VAR EXPR="__('Project')"></title>
> The problem is that Locale::TextDomain uses a different textdomain for each
> package which needs to be set individually (AFAIK) and I can't set the
> textdomain for HTML::Template::Expr as it is an external library.
> Is there a way to set the textdomain for a package from outside the package?

One of the following may work (in order of sanity):

a) Change the default textdomain from "messages" to something different with
Locale::Messages::textdomain().  This will affect the default textdomain for
all packages.  Unfortunately you will need a not yet released version 1.12 of
libintl-perl, since your mail has brought a bug to the surface.  You can also
fix it yourself: In line 216 of Locale::TextDomain (subroutine "import") you
will find a line:

    $textdomain = 'messages' unless
        defined $textdomain && length $textdomain;

This should read:

    $textdomain = Locale::Messages::textdomain() unless
        defined $textdomain && length $textdomain;

b)

    ...
    package HTML::Template::Expr;
    use Locale::TextDomain qw (mydomain);
    package BackToMyPackage;
    ...

c) Change the textdomain for your po/mo files to "messages", and make sure
that they will be found.

Ciao

Guido
--
Imperia AG, Development
Leyboldstr. 10 - D-50354 Hürth - http://www.imperia.net/
Attachments
 1  +-index.html message/rfc822  

ATTENTION: HTML attachments to this mail have been converted to plain text to prevent you from possibly malicious HTML files. Other attachments are included here without any checking. Choose your own poison! The maintainers of this site cannot be held responsible for any damage caused by these attachments.

 Locale::TextDomain and HTML::Template::Expr
 Previous Thread
 Next Thread
 Start of Thread
 Reference
 Previous Reply
 This Message
 Reply
 Next Reply
 
 07/20/04 14:24:41 GMT  Guido Flohr

Powered by Imperia
Home | Top | Imprint