NAME
Valiant::I18N - Translations
SYNOPSIS
package Example::Person;
use Valiant::I18N;
my $tag = _t 'translation_tag';
my $translated_string = Valiant::I18N->translate($tag, %args);
DESCRIPTION
You should see Valiant for some details on how this is used with the core validations code.
CLASS METHODS
This package defines the following class methods
translate ($key, %args)
Given a translation tag will attempt to return a translated string. Also accepts arguments as a hash of values. The follow hash keys has special meaning (all others will be passed as placeholder values for the translation string).
- default
-
An array of translation tags to check if the passed key doesn't resolve. First one to resolve gets returned.
- scope
-
key namespace that will be prepended to the translation tag for lookup.
- count
-
an integer to specify pluralization subkeys.
make_tag ($string)
Given a string, returns it blessed as a translation tag (the same thing the exported _t function creates). Translation tags are how Valiant tells "this string should be localized" apart from plain strings.
is_i18n_tag ($value)
Returns true if the given value is a translation tag (as created by "make_tag" or _t), false otherwise.
set_languages (@languages)
Sets the list of languages (in preference order) used to resolve translations.
detect_languages_from_header ($header)
Given an HTTP Accept-Language header value, detects and sets the languages used to resolve translations.
SEE ALSO
AUTHOR
See Valiant
COPYRIGHT & LICENSE
See Valiant