Project

bcp47_spec

0.02
No commit activity in last 3 years
No release in over 3 years
A subset of the BCP 47 spec.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

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