LanguageTaggish
Raison dโรชtre
While there are not many language tag standards, there at least three in common use. This role aims to define some common features to aid their interaction.
The core attributes (defined as methods in the role) are language
and region
.
These will normally return values in ISO 639 (language) or ISO 3166/UN M.49 (region)
formats, but they are not obligated to.
A bcp47
method should provide conversion into a BCP-47-compliant string. For example,
Apple allows "English" or "Spanish" as valid identifiers for its .lproj
identifiers.
So a theoretical AppleLProj
class that does LanguageTaggish
would output English
for .language
, but for bcp47
, would output en. If a conversion is not possible,
a falsey value should be returned (for example, `self.Str but False`).
It is expected that classes implementing LanguageTaggish will add additional methods
and attributes. In keeping with tradition established by other language tag frameworks
(in particular ICU), requested values not present should return the empty string.
The role handles this by default via its FALLBACK
method. For this reason,
new language tag classes are strongly urged to adopt standard accessor names in line with
extant classes.