Skip to content

dadah89/bcp47_spec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bcp47_spec Build Status

A subset of the BCP 47 spec: https://tools.ietf.org/html/bcp47

Installation

Add this line to your application's Gemfile:

gem 'bcp47_spec'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bcp47_spec

Usage

BCP47.valid?('de-Latn-DE-1996-u-attr-co-phonebk-t-und-cyrl-x-private-test') # true
tag = BCP47.parse('de-Latn-DE-1996-u-attr-co-phonebk-t-und-cyrl-x-private-test')
tag.language  # de
tag.script    # Latn
tag.region    # DE
tag.variant   # [1996]
tag.extension # [['t', 'und-cyrl'], ['u', 'attr-co-phonebk']]
tag.private   # ['private', 'test']
BCP47.parse('blahblahblah') # raises InvalidLanguageTag

TODO

About

A subset of the BCP 47 spec

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages