lib/iso639.rb in iso639-1.0.3 vs lib/iso639.rb in iso639-1.0.4
- old
+ new
@@ -39,11 +39,15 @@
File.readlines(iso639_file).each do |line|
lang = Language.new *line.split("|")
LanguagesByAlpha2[lang.alpha2] = lang if lang.alpha2
LanguagesByAlpha3[lang.alpha3] = lang if lang.alpha3
LanguagesByAlpha3Terminology[lang.alpha3_terminology] = lang if lang.alpha3_terminology
- LanguagesByName[lang.name] = lang if lang.name
- LanguagesByFrenchName[lang.french_name] = lang if lang.french_name
+ lang.name.split(/;\s*/).each do |name|
+ LanguagesByName[name] = lang
+ end
+ lang.french_name.split(/;\s*/).each do |name|
+ LanguagesByFrenchName[name] = lang
+ end
end
# Public: Find a language by any common lookup value
#
# lookup - A String representing an alpha-2, alpha-3, or language name