Text::Domain - Localization of gettext domain settings
use Text::Domain; { my $domain = new Text::Domain 'xyz'; # do stuff here } # restore old textdomain on exit of block
OR
use Text::Domain qw: pushtextdomain poptextdomain :; pushtextdomain 'xyz'; # do stuff here poptextdomain # restore old textdomain
Text::Domain provides an easy way to temporarily change text domains with Locale::gettext|Locale::gettext without forgetting the previous one. Two methods are provided -- a functional, stack-based method, and an object-oriented method.
Locale::gettext|Locale::gettext
The two ways of managing domain changes are not inter-operable. They must be properly nested or the gettext functions might have a different notion of what the domain is than your program does.
For example, the following is allowable:
{ my $domain = new Text::Domain 'my_program'; # do stuff pushtextdomain 'your_program'; # do some more stuff poptextdomain # finish up }
The above results in the following calls to textdomain:
textdomain
$t1 = textdomain('my_program'); $t2 = textdomain('your_program'); textdomain($t2) # restoring 'my_program' textdomain($t1) # restoring original state
But the following will probably lead to some confusion somewhere:
{ my $domain = new Text::Domain 'my_program'; # do stuff pushtextdomain 'your_program'; # finish up } # do some more stuff poptextdomain
This results in the following calls to textdomain:
$t1 = textdomain('my_program'); $t2 = textdomain('your_program'); textdomain($t1) # restoring original state textdomain($t2) # restoring 'my_program'
Locale::gettext.
James G. Smith <jsmith@cpan.org>
Copyright (C) 2001 Texas A&M University. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Text::Domain, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Domain
CPAN shell
perl -MCPAN -e shell install Text::Domain
For more information on module installation, please visit the detailed CPAN module installation guide.