bcp47 0.1.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # bcp47
2
+
3
+ This project is a subset implementation of the BCP47 spec.
4
+
5
+ Currently only the language and region subtags are supported - there is no plan to implement the others.
6
+
7
+ ## Languages
8
+
9
+ Languages are defined by **ISO 639-1 alpha-2**; that is the 2 letter lowercase language code.
10
+
11
+ These have been augmented to contain the plural rule names and the language's direction.
12
+
13
+ > BCP47::Language.find('ru')
14
+
15
+ => #<BCP47::Language:0x007fe2ba43db50
16
+ @plural_rule_names=["one", "few", "many", "other"],
17
+ @direction="ltr",
18
+ @code="ru",
19
+ @name="Russian">
20
+
21
+ ## Regions
22
+
23
+ Regions are defined by **ISO 3166-1**; that is the 2 letter uppercase region code.
24
+
25
+ > BCP47::Region.find('MX')
26
+
27
+ => #<BCP47::Region:0x007fe2ba070e50
28
+ @code="MX",
29
+ @name="Mexico">
30
+
31
+ ## Tags
32
+
33
+ The combination of a language and a region is called a Tag ::
34
+
35
+ > BCP47::Tag.new('pt-BR')
36
+
37
+ => #<BCP47::Tag:0x007fe2bb005b90 @code="pt-BR",
38
+ @language=#<BCP47::Language:0x007fe2ba256918
39
+ @plural_rule_names=["one", "other"],
40
+ @direction="ltr",
41
+ @code="pt",
42
+ @name="Portuguese">,
43
+ @region=#<BCP47::Region:0x007fe2ba412e28
44
+ @code="BR",
45
+ @name="Brazil">>
46
+
47
+ ## Contributing to bcp47
48
+
49
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
50
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
51
+ * Fork the project.
52
+ * Start a feature/bugfix branch.
53
+ * Commit and push until you are happy with your contribution.
54
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
55
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
56
+
57
+ #### Copyright
58
+
59
+ Copyright (c) 2012 Christopher Dell. See LICENSE.txt for further details.
60
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.1
data/bcp47.gemspec CHANGED
@@ -5,16 +5,16 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bcp47}
8
- s.version = "0.1.2"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Christopher Dell}]
12
- s.date = %q{2012-08-23}
12
+ s.date = %q{2012-08-26}
13
13
  s.description = %q{A subset of the BCP47 spec implemented in ruby}
14
14
  s.email = %q{chris@tigrish.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
@@ -23,20 +23,22 @@ Gem::Specification.new do |s|
23
23
  "Gemfile.lock",
24
24
  "Guardfile",
25
25
  "LICENSE.txt",
26
- "README.rdoc",
26
+ "README.md",
27
27
  "Rakefile",
28
28
  "VERSION",
29
29
  "bcp47.gemspec",
30
30
  "data/iso-3166-1.yml",
31
31
  "data/iso-639-1.yml",
32
32
  "lib/bcp47.rb",
33
- "lib/bcp47/subtag/base.rb",
34
- "lib/bcp47/subtag/language.rb",
35
- "lib/bcp47/subtag/region.rb",
33
+ "lib/bcp47/language.rb",
34
+ "lib/bcp47/region.rb",
35
+ "lib/bcp47/subtag.rb",
36
+ "lib/bcp47/tag.rb",
36
37
  "spec/fixtures/base.yml",
37
- "spec/lib/bcp47/subtag/base_spec.rb",
38
- "spec/lib/bcp47/subtag/language_spec.rb",
39
- "spec/lib/bcp47/subtag/region_spec.rb",
38
+ "spec/lib/bcp47/language_spec.rb",
39
+ "spec/lib/bcp47/region_spec.rb",
40
+ "spec/lib/bcp47/subtag_spec.rb",
41
+ "spec/lib/bcp47/tag_spec.rb",
40
42
  "spec/spec_helper.rb"
41
43
  ]
42
44
  s.homepage = %q{http://github.com/tigrish/bcp47}
@@ -49,12 +51,14 @@ Gem::Specification.new do |s|
49
51
  s.specification_version = 3
50
52
 
51
53
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
+ s.add_runtime_dependency(%q<i18n>, [">= 0"])
52
55
  s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
53
56
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
54
57
  s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
55
58
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
56
59
  s.add_development_dependency(%q<guard-rspec>, [">= 0"])
57
60
  else
61
+ s.add_dependency(%q<i18n>, [">= 0"])
58
62
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
59
63
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
60
64
  s.add_dependency(%q<bundler>, ["~> 1.1.0"])
@@ -62,6 +66,7 @@ Gem::Specification.new do |s|
62
66
  s.add_dependency(%q<guard-rspec>, [">= 0"])
63
67
  end
64
68
  else
69
+ s.add_dependency(%q<i18n>, [">= 0"])
65
70
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
66
71
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
67
72
  s.add_dependency(%q<bundler>, ["~> 1.1.0"])
data/lib/bcp47.rb CHANGED
@@ -1,3 +1,4 @@
1
- require 'bcp47/subtag/base'
2
- require 'bcp47/subtag/language'
3
- require 'bcp47/subtag/region'
1
+ require 'bcp47/tag'
2
+ require 'bcp47/subtag'
3
+ require 'bcp47/language'
4
+ require 'bcp47/region'
@@ -1,5 +1,5 @@
1
- class BCP47::Subtag::Language < BCP47::Subtag::Base
2
- DEFINITIONS_FILE = "#{File.dirname(__FILE__)}/../../../data/iso-639-1.yml"
1
+ class BCP47::Language < BCP47::Subtag
2
+ DEFINITIONS_FILE = "#{File.dirname(__FILE__)}/../../data/iso-639-1.yml"
3
3
  DEFAULT_PLURAL_RULE_NAMES = %w(one other)
4
4
  DEFAULT_DIRECTION = 'ltr'
5
5
  DEFAULT_CODE = 'en'
@@ -14,6 +14,7 @@ class BCP47::Subtag::Language < BCP47::Subtag::Base
14
14
  end
15
15
 
16
16
  def self.identify(full_code)
17
- full_code =~ /^([a-z]{2})[-_]?/ ? find($1) : nil
17
+ segments = full_code.split('-')
18
+ segments.first =~ /^([a-z]{2})$/ ? find($1) : nil
18
19
  end
19
20
  end
@@ -0,0 +1,7 @@
1
+ class BCP47::Region < BCP47::Subtag
2
+ DEFINITIONS_FILE = "#{File.dirname(__FILE__)}/../../data/iso-3166-1.yml"
3
+
4
+ def self.identify(full_code)
5
+ full_code =~ /[-_]([A-Z]{2})$/ ? find($1) : nil
6
+ end
7
+ end
@@ -0,0 +1,34 @@
1
+ module BCP47
2
+ class Subtag
3
+ attr_reader :code, :name
4
+
5
+ def initialize(code, options={})
6
+ @code = code
7
+ @name = options[:name]
8
+ end
9
+
10
+ def full_name
11
+ "#{code} - #{name}"
12
+ end
13
+
14
+ def self.all
15
+ YAML.load_file(self::DEFINITIONS_FILE).map do |code, options|
16
+ symbolized_options = {}
17
+ options.keys.each { |key| symbolized_options[key.to_sym] = options[key] }
18
+ new(code, symbolized_options)
19
+ end
20
+ end
21
+
22
+ def self.find(code)
23
+ all.find {|subtag| subtag.code == code }
24
+ end
25
+
26
+ def self.default
27
+ find(self::DEFAULT_CODE)
28
+ end
29
+
30
+ def self.codes
31
+ all.map(&:code)
32
+ end
33
+ end
34
+ end
data/lib/bcp47/tag.rb ADDED
@@ -0,0 +1,15 @@
1
+ module BCP47
2
+ class Tag
3
+ attr_accessor :language, :region
4
+
5
+ def initialize(code)
6
+ @code = code
7
+ @language = Language.identify(code)
8
+ @region = Region.identify(code)
9
+ end
10
+
11
+ def subtags
12
+ [language, region].compact
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe BCP47::Language do
4
+ let(:language) { BCP47::Language.new('de', name: 'German') }
5
+
6
+ it "is a BCP47 Subtag" do
7
+ language.should be_kind_of(BCP47::Subtag)
8
+ end
9
+
10
+ it "has a code" do
11
+ language.code.should == 'de'
12
+ end
13
+
14
+ it "has a name" do
15
+ language.name.should == 'German'
16
+ end
17
+
18
+ describe "#plural_rule_names" do
19
+ it "defaults to %w(one other)" do
20
+ language.plural_rule_names.should == BCP47::Language::DEFAULT_PLURAL_RULE_NAMES
21
+ end
22
+
23
+ it "is overwriteable" do
24
+ language = BCP47::Language.new('ja', plural_rule_names: ['other'])
25
+ language.plural_rule_names.should == ['other']
26
+ end
27
+ end
28
+
29
+ describe "#direction" do
30
+ it "defaults to 'ltr'" do
31
+ language.direction.should == 'ltr'
32
+ end
33
+
34
+ it "is overwriteable" do
35
+ language = BCP47::Language.new('ar', direction: :rtl)
36
+ language.direction.should == :rtl
37
+ end
38
+ end
39
+
40
+ describe ".identify(full_code)" do
41
+ it "identifies from 'de'" do
42
+ BCP47::Language.identify('de').code.should == 'de'
43
+ end
44
+
45
+ it "identifies from 'fr-CH'" do
46
+ BCP47::Language.identify('fr').code.should == 'fr'
47
+ end
48
+
49
+ it "returns nil when it can't identify" do
50
+ BCP47::Language.identify('csb').should be_nil
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe BCP47::Region do
4
+ let(:region) { BCP47::Region.new('FR', name: 'France') }
5
+
6
+ it "is a BCP47 Subtag" do
7
+ region.should be_kind_of(BCP47::Subtag)
8
+ end
9
+
10
+ it "has a code" do
11
+ region.code.should == 'FR'
12
+ end
13
+
14
+ it "has a name" do
15
+ region.name.should == 'France'
16
+ end
17
+
18
+ describe ".identify(full_code)" do
19
+ it "identifies from 'fr-CH'" do
20
+ BCP47::Region.identify('fr-CH').code.should == 'CH'
21
+ end
22
+
23
+ it "identifies from 'es_MX" do
24
+ BCP47::Region.identify('es_MX').code.should == 'MX'
25
+ end
26
+
27
+ it "returns nil when it can't identify" do
28
+ BCP47::Region.identify('gsw').should be_nil
29
+ end
30
+ end
31
+ end
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- class Subtag < BCP47::Subtag::Base
3
+ class Subtag < BCP47::Subtag
4
4
  DEFINITIONS_FILE = "spec/fixtures/base.yml"
5
5
  DEFAULT_CODE = "fr"
6
6
  end
7
7
 
8
- describe BCP47::Subtag::Base do
8
+ describe BCP47::Subtag do
9
9
  describe "full_name" do
10
10
  it "is composed of the code and the name" do
11
11
  full_name = Subtag.find('fr').full_name
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe BCP47::Tag do
4
+ describe ".new(code)" do
5
+ it "returns a tag containing the language and region" do
6
+ tag = BCP47::Tag.new('en-MX')
7
+ tag.language.code.should == 'en'
8
+ tag.region.code.should == 'MX'
9
+ end
10
+
11
+ it "returns a tag containing the language only" do
12
+ tag = BCP47::Tag.new('en-XXXXXX')
13
+ tag.language.code.should == 'en'
14
+ tag.region.should be_nil
15
+ end
16
+
17
+ it "returns a tag containing the region only" do
18
+ tag = BCP47::Tag.new('gsw-CH')
19
+ tag.language.should be_nil
20
+ tag.region.code.should == 'CH'
21
+ end
22
+
23
+ it "returns a tag containing no language or region" do
24
+ tag = BCP47::Tag.new('csb-XXXXXX')
25
+ tag.language.should be_nil
26
+ tag.region.should be_nil
27
+ end
28
+ end
29
+
30
+ describe "#subtags" do
31
+ it "returns an array containing the language" do
32
+ tag = BCP47::Tag.new('fr')
33
+ tag.subtags.size.should == 1
34
+ tag.subtags.first.should be_kind_of(BCP47::Language)
35
+ tag.subtags.first.code.should == 'fr'
36
+ end
37
+
38
+ it "returns an array containing the language and the region" do
39
+ tag = BCP47::Tag.new('fr-CH')
40
+ tag.subtags.size.should == 2
41
+
42
+ tag.subtags.first.should be_kind_of(BCP47::Language)
43
+ tag.subtags.first.code.should == 'fr'
44
+
45
+ tag.subtags.last.should be_kind_of(BCP47::Region)
46
+ tag.subtags.last.code.should == 'CH'
47
+ end
48
+ end
49
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcp47
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-23 00:00:00.000000000 Z
12
+ date: 2012-08-26 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: i18n
16
+ requirement: &70357235142160 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70357235142160
14
25
  - !ruby/object:Gem::Dependency
15
26
  name: rspec
16
- requirement: &70164759082780 !ruby/object:Gem::Requirement
27
+ requirement: &70357235140800 !ruby/object:Gem::Requirement
17
28
  none: false
18
29
  requirements:
19
30
  - - ~>
@@ -21,10 +32,10 @@ dependencies:
21
32
  version: 2.8.0
22
33
  type: :development
23
34
  prerelease: false
24
- version_requirements: *70164759082780
35
+ version_requirements: *70357235140800
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: rdoc
27
- requirement: &70164759081360 !ruby/object:Gem::Requirement
38
+ requirement: &70357235138600 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ~>
@@ -32,10 +43,10 @@ dependencies:
32
43
  version: '3.12'
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *70164759081360
46
+ version_requirements: *70357235138600
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: bundler
38
- requirement: &70164759080520 !ruby/object:Gem::Requirement
49
+ requirement: &70357235109080 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ~>
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: 1.1.0
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *70164759080520
57
+ version_requirements: *70357235109080
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: jeweler
49
- requirement: &70164759079400 !ruby/object:Gem::Requirement
60
+ requirement: &70357235107980 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ~>
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: 1.8.4
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *70164759079400
68
+ version_requirements: *70357235107980
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: guard-rspec
60
- requirement: &70164759078160 !ruby/object:Gem::Requirement
71
+ requirement: &70357235107080 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,14 +76,14 @@ dependencies:
65
76
  version: '0'
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *70164759078160
79
+ version_requirements: *70357235107080
69
80
  description: A subset of the BCP47 spec implemented in ruby
70
81
  email: chris@tigrish.com
71
82
  executables: []
72
83
  extensions: []
73
84
  extra_rdoc_files:
74
85
  - LICENSE.txt
75
- - README.rdoc
86
+ - README.md
76
87
  files:
77
88
  - .document
78
89
  - .rspec
@@ -80,20 +91,22 @@ files:
80
91
  - Gemfile.lock
81
92
  - Guardfile
82
93
  - LICENSE.txt
83
- - README.rdoc
94
+ - README.md
84
95
  - Rakefile
85
96
  - VERSION
86
97
  - bcp47.gemspec
87
98
  - data/iso-3166-1.yml
88
99
  - data/iso-639-1.yml
89
100
  - lib/bcp47.rb
90
- - lib/bcp47/subtag/base.rb
91
- - lib/bcp47/subtag/language.rb
92
- - lib/bcp47/subtag/region.rb
101
+ - lib/bcp47/language.rb
102
+ - lib/bcp47/region.rb
103
+ - lib/bcp47/subtag.rb
104
+ - lib/bcp47/tag.rb
93
105
  - spec/fixtures/base.yml
94
- - spec/lib/bcp47/subtag/base_spec.rb
95
- - spec/lib/bcp47/subtag/language_spec.rb
96
- - spec/lib/bcp47/subtag/region_spec.rb
106
+ - spec/lib/bcp47/language_spec.rb
107
+ - spec/lib/bcp47/region_spec.rb
108
+ - spec/lib/bcp47/subtag_spec.rb
109
+ - spec/lib/bcp47/tag_spec.rb
97
110
  - spec/spec_helper.rb
98
111
  homepage: http://github.com/tigrish/bcp47
99
112
  licenses:
@@ -110,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
123
  version: '0'
111
124
  segments:
112
125
  - 0
113
- hash: 4568033874070610724
126
+ hash: -1915688837701379118
114
127
  required_rubygems_version: !ruby/object:Gem::Requirement
115
128
  none: false
116
129
  requirements:
data/README.rdoc DELETED
@@ -1,19 +0,0 @@
1
- = bcp47
2
-
3
- Description goes here.
4
-
5
- == Contributing to bcp47
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2012 Christopher Dell. See LICENSE.txt for
18
- further details.
19
-
@@ -1,36 +0,0 @@
1
- module BCP47
2
- module Subtag
3
- class Base
4
- attr_reader :code, :name
5
-
6
- def initialize(code, options={})
7
- @code = code
8
- @name = options[:name]
9
- end
10
-
11
- def full_name
12
- "#{code} - #{name}"
13
- end
14
-
15
- def self.all
16
- YAML.load_file(self::DEFINITIONS_FILE).map do |code, options|
17
- symbolized_options = {}
18
- options.keys.each { |key| symbolized_options[key.to_sym] = options[key] }
19
- new(code, symbolized_options)
20
- end
21
- end
22
-
23
- def self.find(code)
24
- all.find {|subtag| subtag.code == code }
25
- end
26
-
27
- def self.default
28
- find(self::DEFAULT_CODE)
29
- end
30
-
31
- def self.codes
32
- all.map(&:code)
33
- end
34
- end
35
- end
36
- end
@@ -1,7 +0,0 @@
1
- class BCP47::Subtag::Region < BCP47::Subtag::Base
2
- DEFINITIONS_FILE = "#{File.dirname(__FILE__)}/../../../data/iso-3166-1.yml"
3
-
4
- def self.identify(full_code)
5
- full_code =~ /[-_]([A-Z]{2})$/ ? find($1) : nil
6
- end
7
- end
@@ -1,57 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe BCP47::Subtag::Language do
4
- let(:language) { BCP47::Subtag::Language.new('de', name: 'German') }
5
-
6
- it "is a BCP47::Subtag" do
7
- language.should be_kind_of(BCP47::Subtag::Base)
8
- end
9
-
10
- it "has a code" do
11
- language.code.should == 'de'
12
- end
13
-
14
- it "has a name" do
15
- language.name.should == 'German'
16
- end
17
-
18
- describe "#plural_rule_names" do
19
- it "defaults to %w(one other)" do
20
- language.plural_rule_names.should == BCP47::Subtag::Language::DEFAULT_PLURAL_RULE_NAMES
21
- end
22
-
23
- it "is overwriteable" do
24
- language = BCP47::Subtag::Language.new('ja', plural_rule_names: ['other'])
25
- language.plural_rule_names.should == ['other']
26
- end
27
- end
28
-
29
- describe "#direction" do
30
- it "defaults to 'ltr'" do
31
- language.direction.should == 'ltr'
32
- end
33
-
34
- it "is overwriteable" do
35
- language = BCP47::Subtag::Language.new('ar', direction: :rtl)
36
- language.direction.should == :rtl
37
- end
38
- end
39
-
40
- describe ".identify(full_code)" do
41
- it "identifies from 'de'" do
42
- BCP47::Subtag::Language.identify('de').code.should == 'de'
43
- end
44
-
45
- it "identifies from 'fr-CH'" do
46
- BCP47::Subtag::Language.identify('fr').code.should == 'fr'
47
- end
48
-
49
- it "identifies from 'es_MX" do
50
- BCP47::Subtag::Language.identify('es_MX').code.should == 'es'
51
- end
52
-
53
- it "returns nil when it can't identify" do
54
- BCP47::Subtag::Language.identify('gsw').should be_nil
55
- end
56
- end
57
- end
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe BCP47::Subtag::Region do
4
- describe ".identify(full_code)" do
5
- it "identifies from 'fr-CH'" do
6
- BCP47::Subtag::Region.identify('fr-CH').code.should == 'CH'
7
- end
8
-
9
- it "identifies from 'es_MX" do
10
- BCP47::Subtag::Region.identify('es_MX').code.should == 'MX'
11
- end
12
-
13
- it "returns nil when it can't identify" do
14
- BCP47::Subtag::Region.identify('gsw').should be_nil
15
- end
16
- end
17
- end