Rand Stats

Intl::LanguageTaggish

zef:guifa

Intl::LanguageTaggish

A role to be implemented by different representations of a language/locale identifier. It provides for the following three methods/attributes:

Unless you are a lower-level internationalization developer, you probably do not want to use this module, and should instead look at Intl::LanguageTag, which is a module that provides an implementation of this role (following BCP-47).

Raison d’être

While there are not many language tag standards, there are several in common use. This role aims to define some common features to aid their interaction.

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.

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.

In addition, each LanguageTaggish implementor is expected to also provide a method COERCE that should provide a best attempt to convert from some other LanguageTaggish object (normally by using .bcp47 first).

Version history