8.122. I18N::LangTagsImplements language tags per RFC 3066. Language tags let you specify a certain language that you'll use in a segment of text or code. I18N::LangTags lets you perform a number of common tasks with language tasks that you might come across when dealing with different protocols and applications. I18N::LangTags is shipped with the Perl 5.8 source kit. It implements the following methods.
alternate_language_tags(language) Returns all language tags that are alternate forms of language:
encode_language_tag(language) Returns the encoding of a language tag. Returns undef if language is invalid.
extract_language_tags(source) Returns a list of what is perceived as valid language tags from source. For example: my $chewbacca_dialect = 'growl, growl, fr, growl, growl!'; extract_language_tags($chewbacca_dialect); # Returns 'fr' Chewbacca is French?! Say it isn't so!
is_dialect_of(lang1, lang2) Returns true if lang1 represents a form of lang2. It doesn't go both ways, so make sure that lang1 comes first.
is_language_tag(language) Returns true if language is a valid language tag. For example: my $gutteral = 'Chewbacca'; is_language_tag($gutteral); # false my $pourquois = 'fr'; is_language_tag($pourquois); # true
locale2language_tag(locale) Takes a locale name and maps it to a language tag. Certain tags aren't mappable, such as C or POSIX, in which case local2language_tag will return an empty list.
same_language_tag(lang1, lang2) Returns true if lang1 and lang2 both represent the same language form. For example:
similarity_language_tag(lang1, lang2) Returns an integer that represents the degree of similarity between lang1 and lang2:
super_languages(language) Returns a list of language tags that are superordinate to language:
Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|