iso639 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/iso639.rb +6 -2
- data/lib/iso639/version.rb +1 -1
- data/test/iso639_test.rb +7 -4
- metadata +1 -1
data/lib/iso639.rb
CHANGED
@@ -41,8 +41,12 @@ module Iso639
|
|
41
41
|
LanguagesByAlpha2[lang.alpha2] = lang if lang.alpha2
|
42
42
|
LanguagesByAlpha3[lang.alpha3] = lang if lang.alpha3
|
43
43
|
LanguagesByAlpha3Terminology[lang.alpha3_terminology] = lang if lang.alpha3_terminology
|
44
|
-
|
45
|
-
|
44
|
+
lang.name.split(/;\s*/).each do |name|
|
45
|
+
LanguagesByName[name] = lang
|
46
|
+
end
|
47
|
+
lang.french_name.split(/;\s*/).each do |name|
|
48
|
+
LanguagesByFrenchName[name] = lang
|
49
|
+
end
|
46
50
|
end
|
47
51
|
|
48
52
|
# Public: Find a language by any common lookup value
|
data/lib/iso639/version.rb
CHANGED
data/test/iso639_test.rb
CHANGED
@@ -46,10 +46,13 @@ end
|
|
46
46
|
|
47
47
|
describe Iso639::LanguagesByEnglishName do
|
48
48
|
it "should return valid languages by name" do
|
49
|
-
assert_equal "en",
|
50
|
-
assert_equal "fre",
|
51
|
-
assert_equal "German",
|
52
|
-
assert_equal "German",
|
49
|
+
assert_equal "en", Iso639::LanguagesByName["ENGLISH"].alpha2
|
50
|
+
assert_equal "fre", Iso639::LanguagesByName["French"].alpha3
|
51
|
+
assert_equal "German", Iso639::LanguagesByName["German"].name
|
52
|
+
assert_equal "German", Iso639::LanguagesByName["german"].name
|
53
|
+
assert_equal "spa", Iso639::LanguagesByName["spanish"].alpha3
|
54
|
+
assert_equal "klingon", Iso639::LanguagesByName["Klingon"].french_name
|
55
|
+
assert_equal "Klingon; tlhIngan-Hol", Iso639::LanguagesByName["tlhIngan-Hol"].name
|
53
56
|
end
|
54
57
|
|
55
58
|
it "should return nil for unknown codes" do
|