Catmandu::I18N(3pm) | User Contributed Perl Documentation | Catmandu::I18N(3pm) |
Catmandu::I18N - tools for text localisation
use Catmandu::Sane; use Catmandu::I18N; my $i = Catmandu::I18N->new( config => { en => [ "Gettext", "/path/to/en.po" ], nl => [ "Gettext", "/path/to/nl.po" ] } ); $i->t( "my-lang", "my-key" ); $i->t( "my-lang", "my-key2", "arg-1", "arg-2" );
Must be either:
* hash reference
* string (e.g. "i18n")
When the config is a string, it is interpreted as the path to the I18N configuration in Catmandu config.
Required
Possible values:
* "undef" : return undef
* "auto" : return key itself. Always a result.
* "die" : die
Default: "undef"
Note: "undef" should be a string, as opposed to undef.
* must be array reference
* default is [ "i-default","en","en-US" ] as determined by Locale::Maketext
When Locale::Maketext does not find the specified language in your config, it will fallback to one of these, and then load the handle for that.
Only if that fallback language does not exist in the config, will it fail.
Example 1:
fallback_languages is [ "en" ]
you have only language "en" in your config, but you request language "nl", then you'll get the message in English.
Example 2:
fallback_languages is [ "en" ]
you have only language "nl" in your config, but you request language "fr", then the creation of the message will fail
You can set this to an empty array for consistent behaviour.
* the lexicon implementation determines the format of the message.
e.g. only Locale::Maketext::Lexicon::Gettext supports placeholders like %1.
For other implementations you need to use placeholders like [_1]
Nicolas Franck "<nicolas.franck at ugent.be>"
Catmandu::Fix::i18n, Locale::Maketext::Lexicon::CatmanduConfig, Catmandu, Locale::Maketext
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See <http://dev.perl.org/licenses/> for more information.
2023-02-04 | perl v5.36.0 |