Author image Mathew Robertson
and 1 contributors


Locale::MakePhrase::LanguageRule - rule instance for a given translation.


This is a container for the currently translated phrase. Its main purpose is to validate the translation rule so that Locale::MakePhrase doesn't need to do it.

When implementing custom backing stores, you will need to construct these per translation that can be returned.


The following methods are available:


Construct an instance of the language rule. Takes a hash or hashref with the following options:


The input phrase used to generate this translation. (The backing store uses it as a search criteria, hence the name 'key'.)


The language tag that is associated with this specific translation.

Since Locale::MakePhrase will ask the backing store for all possible translations of a phrase based on the language tags that it resolved during construction, the translation specific language tag is stored with the actual translation.


The rule expression that will be evaluated when program arguments are supplied when trying to translate a phrase.


When figuring out which rule to apply, Locale::MakePhrase::RuleManager will sort the rules so that the highest priority rules get evaluated first.


This the text that will be output; it can contain placeholders for program argument substitution.

$string key()

Returns the phrase used as the key for translation lookup.

$string language()

Returns the language tag for this translated text.

$string expression()

Returns the expression that will be evaluated for this phrase.

$integer priority()

Return the priority of this phrase.

$string translation()

Returns the output phrase that matches the input key, for the given language.


You shouldn't need to sub-class this module, as it is simply used as a container.