Skip to content

thedarkwinter/Net-IDN-LanguageTag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Net-IDN-LanguageTag


Net-IDN-LanguageTag attemts to automatically parse RFC5646 language tags into a Class::Accessor object and build as much information as possible. For example, if your language tag is en-GB (language-region), the accesssor will contain the following methods.

At the moment its a bit limited with more complex tags.

TODO: http://www.langtag.net/ has some regexs that might help...


Usage

$tag = Net::IDN::LanguageTag->new('en-GB-Latn'); # new object parses immediately  
print $tag->language(); # en  
print $tag->region(); # GB
print $tag->script(); # Latn  

# using ISO names
print $tag->iso639_1(); #  en  
print $tag->iso639_2(); # eng  
print $tag->iso3166_1(); # GB  
print $tag->iso15924(); # Latn

# human readable  
print $tag->language_name(); # English  
print $tag->region_name(); # United Kingdom  
print $tag->script_name(); # Latin   

See: http://tools.ietf.org/html/rfc5646

About

RFC5646 Parser: splits Language Tag into relevant ISO codes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages