iso-639 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 William Melody
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,62 @@
1
+ # ISO 639
2
+
3
+ A Ruby gem that provides the ISO 639-2 and ISO 639-1 data sets along with a some convenience methods for accessing different entries and entry fields. The data comes from the [LOC ISO 639-2 UTF-8 data set](http://www.loc.gov/standards/iso639-2/ascii_8bits.html).
4
+
5
+ To install:
6
+
7
+ gem install iso-639
8
+
9
+ The [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) specification uses a two-letter code to identify a language and is often the recommended way to identify languages in computer applications. The ISO 639-1 specification covers most developed and widely used languages.
10
+
11
+ The [ISO 639-2](http://www.loc.gov/standards/iso639-2/) ([Wikipedia](http://en.wikipedia.org/wiki/ISO_639-2)) specification uses a three-letter code, is used primarily in bibliography and terminology and covers many more languages than the ISO 639-1 specification.
12
+
13
+ The other ISO 639 standards are considered beyond the scope of this library.
14
+
15
+ ## Usage
16
+
17
+ require 'iso-639'
18
+
19
+ To find a language entry:
20
+
21
+ # by alpha-2 or alpha-3 code
22
+ ISO_639.find_by_code("en")
23
+ # or
24
+ ISO_639.find("en")
25
+ # by English name
26
+ ISO_639.find_by_english_name("Russian")
27
+ # by French name
28
+ ISO_639.find_by_french_name("français")
29
+
30
+ Entries are arrays with convenience methods for accessing fields:
31
+
32
+ @entry = ISO_639.find("slo")
33
+ # => ["slo", "slk", "sk", "Slovak", "slovaque"]
34
+ @entry.alpha3_bibliographic
35
+ # => "slo"
36
+ @entry.alpha3 # shortcut for #alpha3_bibliographic
37
+ # => "slo"
38
+ @entry.alpha3_terminologic
39
+ # => "slk"
40
+ @entry.alpha2
41
+ # => "sk"
42
+ @entry.english_name
43
+ # => "Slovak"
44
+ @entry.french_name
45
+ # => "slovaque"
46
+
47
+ The full data set is available through the `ISO_639::ISO_639_1` and `ISO_639::ISO_639_2` constants.
48
+
49
+ ## Note on Patches/Pull Requests
50
+
51
+ * Fork the project.
52
+ * Make your feature addition or bug fix.
53
+ * Add tests for it. This is important so I don't break it in a
54
+ future version unintentionally.
55
+ * Commit, do not mess with rakefile, version, or history.
56
+ (if you want to have your own version, that is fine but
57
+ bump version in a commit by itself I can ignore when I pull)
58
+ * Send me a pull request. Bonus points for topic branches.
59
+
60
+ ## Copyright
61
+
62
+ Copyright (c) 2010 William Melody. See LICENSE for details.
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "iso-639"
8
+ gem.summary = %Q{ISO 639-1 and ISO 639-2 language code entries and convenience methods}
9
+ gem.description = %Q{ISO 639-1 and ISO 639-2 language code entries and convenience methods}
10
+ gem.email = "hi@williammelody.com"
11
+ gem.homepage = "http://github.com/autodata/iso-639"
12
+ gem.authors = ["William Melody"]
13
+ gem.add_development_dependency "thoughtbot-shoulda"
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
+ end
19
+
20
+ require 'rake/testtask'
21
+ Rake::TestTask.new(:test) do |test|
22
+ test.libs << 'lib' << 'test'
23
+ test.pattern = 'test/**/test_*.rb'
24
+ test.verbose = true
25
+ end
26
+
27
+ begin
28
+ require 'rcov/rcovtask'
29
+ Rcov::RcovTask.new do |test|
30
+ test.libs << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+ rescue LoadError
35
+ task :rcov do
36
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
37
+ end
38
+ end
39
+
40
+ task :test => :check_dependencies
41
+
42
+ task :default => :test
43
+
44
+ require 'rake/rdoctask'
45
+ Rake::RDocTask.new do |rdoc|
46
+ if File.exist?('VERSION')
47
+ version = File.read('VERSION')
48
+ else
49
+ version = ""
50
+ end
51
+
52
+ rdoc.rdoc_dir = 'rdoc'
53
+ rdoc.title = "ISO-639 #{version}"
54
+ rdoc.rdoc_files.include('README*')
55
+ rdoc.rdoc_files.include('lib/**/*.rb')
56
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,54 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{iso-639}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["William Melody"]
12
+ s.date = %q{2010-01-20}
13
+ s.description = %q{ISO 639-1 and ISO 639-2 language code entries and convenience methods}
14
+ s.email = %q{hi@williammelody.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.md",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "iso-639.gemspec",
27
+ "lib/iso-639.rb",
28
+ "test/test_ISO_639.rb",
29
+ "test/test_helper.rb"
30
+ ]
31
+ s.homepage = %q{http://github.com/autodata/iso-639}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.5}
35
+ s.summary = %q{ISO 639-1 and ISO 639-2 language code entries and convenience methods}
36
+ s.test_files = [
37
+ "test/test_helper.rb",
38
+ "test/test_ISO_639.rb"
39
+ ]
40
+
41
+ if s.respond_to? :specification_version then
42
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
47
+ else
48
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
49
+ end
50
+ else
51
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
52
+ end
53
+ end
54
+
@@ -0,0 +1,547 @@
1
+ # encoding: UTF-8
2
+ # http://www.loc.gov/standards/iso639-2/ascii_8bits.html
3
+
4
+ class ISO_639 < Array
5
+
6
+ # The ISO 639-2 dataset as an array of entries. Each entry is an array with
7
+ # the following format:
8
+ # * [0]: an alpha-3 (bibliographic) code
9
+ # * [1]: an alpha-3 (terminologic) code (when given)
10
+ # * [2]: an alpha-2 code (when given)
11
+ # * [3]: an English name
12
+ # * [4]: a French name of a language
13
+ ISO_639_2 = [
14
+ self["aar", "", "aa", "Afar", "afar"],
15
+ self["abk", "", "ab", "Abkhazian", "abkhaze"],
16
+ self["ace", "", "", "Achinese", "aceh"],
17
+ self["ach", "", "", "Acoli", "acoli"],
18
+ self["ada", "", "", "Adangme", "adangme"],
19
+ self["ady", "", "", "Adyghe; Adygei", "adyghé"],
20
+ self["afa", "", "", "Afro-Asiatic languages", "afro-asiatiques, langues"],
21
+ self["afh", "", "", "Afrihili", "afrihili"],
22
+ self["afr", "", "af", "Afrikaans", "afrikaans"],
23
+ self["ain", "", "", "Ainu", "aïnou"],
24
+ self["aka", "", "ak", "Akan", "akan"],
25
+ self["akk", "", "", "Akkadian", "akkadien"],
26
+ self["alb", "sqi", "sq", "Albanian", "albanais"],
27
+ self["ale", "", "", "Aleut", "aléoute"],
28
+ self["alg", "", "", "Algonquian languages", "algonquines, langues"],
29
+ self["alt", "", "", "Southern Altai", "altai du Sud"],
30
+ self["amh", "", "am", "Amharic", "amharique"],
31
+ self["ang", "", "", "English, Old (ca.450-1100)", "anglo-saxon (ca.450-1100)"],
32
+ self["anp", "", "", "Angika", "angika"],
33
+ self["apa", "", "", "Apache languages", "apaches, langues"],
34
+ self["ara", "", "ar", "Arabic", "arabe"],
35
+ self["arc", "", "", "Official Aramaic (700-300 BCE); Imperial Aramaic (700-300 BCE)", "araméen d'empire (700-300 BCE)"],
36
+ self["arg", "", "an", "Aragonese", "aragonais"],
37
+ self["arm", "hye", "hy", "Armenian", "arménien"],
38
+ self["arn", "", "", "Mapudungun; Mapuche", "mapudungun; mapuche; mapuce"],
39
+ self["arp", "", "", "Arapaho", "arapaho"],
40
+ self["art", "", "", "Artificial languages", "artificielles, langues"],
41
+ self["arw", "", "", "Arawak", "arawak"],
42
+ self["asm", "", "as", "Assamese", "assamais"],
43
+ self["ast", "", "", "Asturian; Bable; Leonese; Asturleonese", "asturien; bable; léonais; asturoléonais"],
44
+ self["ath", "", "", "Athapascan languages", "athapascanes, langues"],
45
+ self["aus", "", "", "Australian languages", "australiennes, langues"],
46
+ self["ava", "", "av", "Avaric", "avar"],
47
+ self["ave", "", "ae", "Avestan", "avestique"],
48
+ self["awa", "", "", "Awadhi", "awadhi"],
49
+ self["aym", "", "ay", "Aymara", "aymara"],
50
+ self["aze", "", "az", "Azerbaijani", "azéri"],
51
+ self["bad", "", "", "Banda languages", "banda, langues"],
52
+ self["bai", "", "", "Bamileke languages", "bamiléké, langues"],
53
+ self["bak", "", "ba", "Bashkir", "bachkir"],
54
+ self["bal", "", "", "Baluchi", "baloutchi"],
55
+ self["bam", "", "bm", "Bambara", "bambara"],
56
+ self["ban", "", "", "Balinese", "balinais"],
57
+ self["baq", "eus", "eu", "Basque", "basque"],
58
+ self["bas", "", "", "Basa", "basa"],
59
+ self["bat", "", "", "Baltic languages", "baltes, langues"],
60
+ self["bej", "", "", "Beja; Bedawiyet", "bedja"],
61
+ self["bel", "", "be", "Belarusian", "biélorusse"],
62
+ self["bem", "", "", "Bemba", "bemba"],
63
+ self["ben", "", "bn", "Bengali", "bengali"],
64
+ self["ber", "", "", "Berber languages", "berbères, langues"],
65
+ self["bho", "", "", "Bhojpuri", "bhojpuri"],
66
+ self["bih", "", "bh", "Bihari languages", "langues biharis"],
67
+ self["bik", "", "", "Bikol", "bikol"],
68
+ self["bin", "", "", "Bini; Edo", "bini; edo"],
69
+ self["bis", "", "bi", "Bislama", "bichlamar"],
70
+ self["bla", "", "", "Siksika", "blackfoot"],
71
+ self["bnt", "", "", "Bantu (Other)", "bantoues, autres langues"],
72
+ self["bos", "", "bs", "Bosnian", "bosniaque"],
73
+ self["bra", "", "", "Braj", "braj"],
74
+ self["bre", "", "br", "Breton", "breton"],
75
+ self["btk", "", "", "Batak languages", "batak, langues"],
76
+ self["bua", "", "", "Buriat", "bouriate"],
77
+ self["bug", "", "", "Buginese", "bugi"],
78
+ self["bul", "", "bg", "Bulgarian", "bulgare"],
79
+ self["bur", "mya", "my", "Burmese", "birman"],
80
+ self["byn", "", "", "Blin; Bilin", "blin; bilen"],
81
+ self["cad", "", "", "Caddo", "caddo"],
82
+ self["cai", "", "", "Central American Indian languages", "amérindiennes de L'Amérique centrale, langues"],
83
+ self["car", "", "", "Galibi Carib", "karib; galibi; carib"],
84
+ self["cat", "", "ca", "Catalan; Valencian", "catalan; valencien"],
85
+ self["cau", "", "", "Caucasian languages", "caucasiennes, langues"],
86
+ self["ceb", "", "", "Cebuano", "cebuano"],
87
+ self["cel", "", "", "Celtic languages", "celtiques, langues; celtes, langues"],
88
+ self["cha", "", "ch", "Chamorro", "chamorro"],
89
+ self["chb", "", "", "Chibcha", "chibcha"],
90
+ self["che", "", "ce", "Chechen", "tchétchène"],
91
+ self["chg", "", "", "Chagatai", "djaghataï"],
92
+ self["chi", "zho", "zh", "Chinese", "chinois"],
93
+ self["chk", "", "", "Chuukese", "chuuk"],
94
+ self["chm", "", "", "Mari", "mari"],
95
+ self["chn", "", "", "Chinook jargon", "chinook, jargon"],
96
+ self["cho", "", "", "Choctaw", "choctaw"],
97
+ self["chp", "", "", "Chipewyan; Dene Suline", "chipewyan"],
98
+ self["chr", "", "", "Cherokee", "cherokee"],
99
+ self["chu", "", "cu", "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic", "slavon d'église; vieux slave; slavon liturgique; vieux bulgare"],
100
+ self["chv", "", "cv", "Chuvash", "tchouvache"],
101
+ self["chy", "", "", "Cheyenne", "cheyenne"],
102
+ self["cmc", "", "", "Chamic languages", "chames, langues"],
103
+ self["cop", "", "", "Coptic", "copte"],
104
+ self["cor", "", "kw", "Cornish", "cornique"],
105
+ self["cos", "", "co", "Corsican", "corse"],
106
+ self["cpe", "", "", "Creoles and pidgins, English based", "créoles et pidgins basés sur l'anglais"],
107
+ self["cpf", "", "", "Creoles and pidgins, French-based ", "créoles et pidgins basés sur le français"],
108
+ self["cpp", "", "", "Creoles and pidgins, Portuguese-based ", "créoles et pidgins basés sur le portugais"],
109
+ self["cre", "", "cr", "Cree", "cree"],
110
+ self["crh", "", "", "Crimean Tatar; Crimean Turkish", "tatar de Crimé"],
111
+ self["crp", "", "", "Creoles and pidgins ", "créoles et pidgins"],
112
+ self["csb", "", "", "Kashubian", "kachoube"],
113
+ self["cus", "", "", "Cushitic languages", "couchitiques, langues"],
114
+ self["cze", "ces", "cs", "Czech", "tchèque"],
115
+ self["dak", "", "", "Dakota", "dakota"],
116
+ self["dan", "", "da", "Danish", "danois"],
117
+ self["dar", "", "", "Dargwa", "dargwa"],
118
+ self["day", "", "", "Land Dayak languages", "dayak, langues"],
119
+ self["del", "", "", "Delaware", "delaware"],
120
+ self["den", "", "", "Slave (Athapascan)", "esclave (athapascan)"],
121
+ self["dgr", "", "", "Dogrib", "dogrib"],
122
+ self["din", "", "", "Dinka", "dinka"],
123
+ self["div", "", "dv", "Divehi; Dhivehi; Maldivian", "maldivien"],
124
+ self["doi", "", "", "Dogri", "dogri"],
125
+ self["dra", "", "", "Dravidian languages", "dravidiennes, langues"],
126
+ self["dsb", "", "", "Lower Sorbian", "bas-sorabe"],
127
+ self["dua", "", "", "Duala", "douala"],
128
+ self["dum", "", "", "Dutch, Middle (ca.1050-1350)", "néerlandais moyen (ca. 1050-1350)"],
129
+ self["dut", "nld", "nl", "Dutch; Flemish", "néerlandais; flamand"],
130
+ self["dyu", "", "", "Dyula", "dioula"],
131
+ self["dzo", "", "dz", "Dzongkha", "dzongkha"],
132
+ self["efi", "", "", "Efik", "efik"],
133
+ self["egy", "", "", "Egyptian (Ancient)", "égyptien"],
134
+ self["eka", "", "", "Ekajuk", "ekajuk"],
135
+ self["elx", "", "", "Elamite", "élamite"],
136
+ self["eng", "", "en", "English", "anglais"],
137
+ self["enm", "", "", "English, Middle (1100-1500)", "anglais moyen (1100-1500)"],
138
+ self["epo", "", "eo", "Esperanto", "espéranto"],
139
+ self["est", "", "et", "Estonian", "estonien"],
140
+ self["ewe", "", "ee", "Ewe", "éwé"],
141
+ self["ewo", "", "", "Ewondo", "éwondo"],
142
+ self["fan", "", "", "Fang", "fang"],
143
+ self["fao", "", "fo", "Faroese", "féroïen"],
144
+ self["fat", "", "", "Fanti", "fanti"],
145
+ self["fij", "", "fj", "Fijian", "fidjien"],
146
+ self["fil", "", "", "Filipino; Pilipino", "filipino; pilipino"],
147
+ self["fin", "", "fi", "Finnish", "finnois"],
148
+ self["fiu", "", "", "Finno-Ugrian languages", "finno-ougriennes, langues"],
149
+ self["fon", "", "", "Fon", "fon"],
150
+ self["fre", "fra", "fr", "French", "français"],
151
+ self["frm", "", "", "French, Middle (ca.1400-1600)", "français moyen (1400-1600)"],
152
+ self["fro", "", "", "French, Old (842-ca.1400)", "français ancien (842-ca.1400)"],
153
+ self["frr", "", "", "Northern Frisian", "frison septentrional"],
154
+ self["frs", "", "", "Eastern Frisian", "frison oriental"],
155
+ self["fry", "", "fy", "Western Frisian", "frison occidental"],
156
+ self["ful", "", "ff", "Fulah", "peul"],
157
+ self["fur", "", "", "Friulian", "frioulan"],
158
+ self["gaa", "", "", "Ga", "ga"],
159
+ self["gay", "", "", "Gayo", "gayo"],
160
+ self["gba", "", "", "Gbaya", "gbaya"],
161
+ self["gem", "", "", "Germanic languages", "germaniques, langues"],
162
+ self["geo", "kat", "ka", "Georgian", "géorgien"],
163
+ self["ger", "deu", "de", "German", "allemand"],
164
+ self["gez", "", "", "Geez", "guèze"],
165
+ self["gil", "", "", "Gilbertese", "kiribati"],
166
+ self["gla", "", "gd", "Gaelic; Scottish Gaelic", "gaélique; gaélique écossais"],
167
+ self["gle", "", "ga", "Irish", "irlandais"],
168
+ self["glg", "", "gl", "Galician", "galicien"],
169
+ self["glv", "", "gv", "Manx", "manx; mannois"],
170
+ self["gmh", "", "", "German, Middle High (ca.1050-1500)", "allemand, moyen haut (ca. 1050-1500)"],
171
+ self["goh", "", "", "German, Old High (ca.750-1050)", "allemand, vieux haut (ca. 750-1050)"],
172
+ self["gon", "", "", "Gondi", "gond"],
173
+ self["gor", "", "", "Gorontalo", "gorontalo"],
174
+ self["got", "", "", "Gothic", "gothique"],
175
+ self["grb", "", "", "Grebo", "grebo"],
176
+ self["grc", "", "", "Greek, Ancient (to 1453)", "grec ancien (jusqu'à 1453)"],
177
+ self["gre", "ell", "el", "Greek, Modern (1453-)", "grec moderne (après 1453)"],
178
+ self["grn", "", "gn", "Guarani", "guarani"],
179
+ self["gsw", "", "", "Swiss German; Alemannic; Alsatian", "suisse alémanique; alémanique; alsacien"],
180
+ self["guj", "", "gu", "Gujarati", "goudjrati"],
181
+ self["gwi", "", "", "Gwich'in", "gwich'in"],
182
+ self["hai", "", "", "Haida", "haida"],
183
+ self["hat", "", "ht", "Haitian; Haitian Creole", "haïtien; créole haïtien"],
184
+ self["hau", "", "ha", "Hausa", "haoussa"],
185
+ self["haw", "", "", "Hawaiian", "hawaïen"],
186
+ self["heb", "", "he", "Hebrew", "hébreu"],
187
+ self["her", "", "hz", "Herero", "herero"],
188
+ self["hil", "", "", "Hiligaynon", "hiligaynon"],
189
+ self["him", "", "", "Himachali languages; Western Pahari languages", "langues himachalis; langues paharis occidentales"],
190
+ self["hin", "", "hi", "Hindi", "hindi"],
191
+ self["hit", "", "", "Hittite", "hittite"],
192
+ self["hmn", "", "", "Hmong", "hmong"],
193
+ self["hmo", "", "ho", "Hiri Motu", "hiri motu"],
194
+ self["hrv", "", "hr", "Croatian", "croate"],
195
+ self["hsb", "", "", "Upper Sorbian", "haut-sorabe"],
196
+ self["hun", "", "hu", "Hungarian", "hongrois"],
197
+ self["hup", "", "", "Hupa", "hupa"],
198
+ self["iba", "", "", "Iban", "iban"],
199
+ self["ibo", "", "ig", "Igbo", "igbo"],
200
+ self["ice", "isl", "is", "Icelandic", "islandais"],
201
+ self["ido", "", "io", "Ido", "ido"],
202
+ self["iii", "", "ii", "Sichuan Yi; Nuosu", "yi de Sichuan"],
203
+ self["ijo", "", "", "Ijo languages", "ijo, langues"],
204
+ self["iku", "", "iu", "Inuktitut", "inuktitut"],
205
+ self["ile", "", "ie", "Interlingue; Occidental", "interlingue"],
206
+ self["ilo", "", "", "Iloko", "ilocano"],
207
+ self["ina", "", "ia", "Interlingua (International Auxiliary Language Association)", "interlingua (langue auxiliaire internationale)"],
208
+ self["inc", "", "", "Indic languages", "indo-aryennes, langues"],
209
+ self["ind", "", "id", "Indonesian", "indonésien"],
210
+ self["ine", "", "", "Indo-European languages", "indo-européennes, langues"],
211
+ self["inh", "", "", "Ingush", "ingouche"],
212
+ self["ipk", "", "ik", "Inupiaq", "inupiaq"],
213
+ self["ira", "", "", "Iranian languages", "iraniennes, langues"],
214
+ self["iro", "", "", "Iroquoian languages", "iroquoises, langues"],
215
+ self["ita", "", "it", "Italian", "italien"],
216
+ self["jav", "", "jv", "Javanese", "javanais"],
217
+ self["jbo", "", "", "Lojban", "lojban"],
218
+ self["jpn", "", "ja", "Japanese", "japonais"],
219
+ self["jpr", "", "", "Judeo-Persian", "judéo-persan"],
220
+ self["jrb", "", "", "Judeo-Arabic", "judéo-arabe"],
221
+ self["kaa", "", "", "Kara-Kalpak", "karakalpak"],
222
+ self["kab", "", "", "Kabyle", "kabyle"],
223
+ self["kac", "", "", "Kachin; Jingpho", "kachin; jingpho"],
224
+ self["kal", "", "kl", "Kalaallisut; Greenlandic", "groenlandais"],
225
+ self["kam", "", "", "Kamba", "kamba"],
226
+ self["kan", "", "kn", "Kannada", "kannada"],
227
+ self["kar", "", "", "Karen languages", "karen, langues"],
228
+ self["kas", "", "ks", "Kashmiri", "kashmiri"],
229
+ self["kau", "", "kr", "Kanuri", "kanouri"],
230
+ self["kaw", "", "", "Kawi", "kawi"],
231
+ self["kaz", "", "kk", "Kazakh", "kazakh"],
232
+ self["kbd", "", "", "Kabardian", "kabardien"],
233
+ self["kha", "", "", "Khasi", "khasi"],
234
+ self["khi", "", "", "Khoisan languages", "khoïsan, langues"],
235
+ self["khm", "", "km", "Central Khmer", "khmer central"],
236
+ self["kho", "", "", "Khotanese; Sakan", "khotanais; sakan"],
237
+ self["kik", "", "ki", "Kikuyu; Gikuyu", "kikuyu"],
238
+ self["kin", "", "rw", "Kinyarwanda", "rwanda"],
239
+ self["kir", "", "ky", "Kirghiz; Kyrgyz", "kirghiz"],
240
+ self["kmb", "", "", "Kimbundu", "kimbundu"],
241
+ self["kok", "", "", "Konkani", "konkani"],
242
+ self["kom", "", "kv", "Komi", "kom"],
243
+ self["kon", "", "kg", "Kongo", "kongo"],
244
+ self["kor", "", "ko", "Korean", "coréen"],
245
+ self["kos", "", "", "Kosraean", "kosrae"],
246
+ self["kpe", "", "", "Kpelle", "kpellé"],
247
+ self["krc", "", "", "Karachay-Balkar", "karatchai balkar"],
248
+ self["krl", "", "", "Karelian", "carélien"],
249
+ self["kro", "", "", "Kru languages", "krou, langues"],
250
+ self["kru", "", "", "Kurukh", "kurukh"],
251
+ self["kua", "", "kj", "Kuanyama; Kwanyama", "kuanyama; kwanyama"],
252
+ self["kum", "", "", "Kumyk", "koumyk"],
253
+ self["kur", "", "ku", "Kurdish", "kurde"],
254
+ self["kut", "", "", "Kutenai", "kutenai"],
255
+ self["lad", "", "", "Ladino", "judéo-espagnol"],
256
+ self["lah", "", "", "Lahnda", "lahnda"],
257
+ self["lam", "", "", "Lamba", "lamba"],
258
+ self["lao", "", "lo", "Lao", "lao"],
259
+ self["lat", "", "la", "Latin", "latin"],
260
+ self["lav", "", "lv", "Latvian", "letton"],
261
+ self["lez", "", "", "Lezghian", "lezghien"],
262
+ self["lim", "", "li", "Limburgan; Limburger; Limburgish", "limbourgeois"],
263
+ self["lin", "", "ln", "Lingala", "lingala"],
264
+ self["lit", "", "lt", "Lithuanian", "lituanien"],
265
+ self["lol", "", "", "Mongo", "mongo"],
266
+ self["loz", "", "", "Lozi", "lozi"],
267
+ self["ltz", "", "lb", "Luxembourgish; Letzeburgesch", "luxembourgeois"],
268
+ self["lua", "", "", "Luba-Lulua", "luba-lulua"],
269
+ self["lub", "", "lu", "Luba-Katanga", "luba-katanga"],
270
+ self["lug", "", "lg", "Ganda", "ganda"],
271
+ self["lui", "", "", "Luiseno", "luiseno"],
272
+ self["lun", "", "", "Lunda", "lunda"],
273
+ self["luo", "", "", "Luo (Kenya and Tanzania)", "luo (Kenya et Tanzanie)"],
274
+ self["lus", "", "", "Lushai", "lushai"],
275
+ self["mac", "mkd", "mk", "Macedonian", "macédonien"],
276
+ self["mad", "", "", "Madurese", "madourais"],
277
+ self["mag", "", "", "Magahi", "magahi"],
278
+ self["mah", "", "mh", "Marshallese", "marshall"],
279
+ self["mai", "", "", "Maithili", "maithili"],
280
+ self["mak", "", "", "Makasar", "makassar"],
281
+ self["mal", "", "ml", "Malayalam", "malayalam"],
282
+ self["man", "", "", "Mandingo", "mandingue"],
283
+ self["mao", "mri", "mi", "Maori", "maori"],
284
+ self["map", "", "", "Austronesian languages", "austronésiennes, langues"],
285
+ self["mar", "", "mr", "Marathi", "marathe"],
286
+ self["mas", "", "", "Masai", "massaï"],
287
+ self["may", "msa", "ms", "Malay", "malais"],
288
+ self["mdf", "", "", "Moksha", "moksa"],
289
+ self["mdr", "", "", "Mandar", "mandar"],
290
+ self["men", "", "", "Mende", "mendé"],
291
+ self["mga", "", "", "Irish, Middle (900-1200)", "irlandais moyen (900-1200)"],
292
+ self["mic", "", "", "Mi'kmaq; Micmac", "mi'kmaq; micmac"],
293
+ self["min", "", "", "Minangkabau", "minangkabau"],
294
+ self["mis", "", "", "Uncoded languages", "langues non codées"],
295
+ self["mkh", "", "", "Mon-Khmer languages", "môn-khmer, langues"],
296
+ self["mlg", "", "mg", "Malagasy", "malgache"],
297
+ self["mlt", "", "mt", "Maltese", "maltais"],
298
+ self["mnc", "", "", "Manchu", "mandchou"],
299
+ self["mni", "", "", "Manipuri", "manipuri"],
300
+ self["mno", "", "", "Manobo languages", "manobo, langues"],
301
+ self["moh", "", "", "Mohawk", "mohawk"],
302
+ self["mon", "", "mn", "Mongolian", "mongol"],
303
+ self["mos", "", "", "Mossi", "moré"],
304
+ self["mul", "", "", "Multiple languages", "multilingue"],
305
+ self["mun", "", "", "Munda languages", "mounda, langues"],
306
+ self["mus", "", "", "Creek", "muskogee"],
307
+ self["mwl", "", "", "Mirandese", "mirandais"],
308
+ self["mwr", "", "", "Marwari", "marvari"],
309
+ self["myn", "", "", "Mayan languages", "maya, langues"],
310
+ self["myv", "", "", "Erzya", "erza"],
311
+ self["nah", "", "", "Nahuatl languages", "nahuatl, langues"],
312
+ self["nai", "", "", "North American Indian languages", "nord-amérindiennes, langues"],
313
+ self["nap", "", "", "Neapolitan", "napolitain"],
314
+ self["nau", "", "na", "Nauru", "nauruan"],
315
+ self["nav", "", "nv", "Navajo; Navaho", "navaho"],
316
+ self["nbl", "", "nr", "Ndebele, South; South Ndebele", "ndébélé du Sud"],
317
+ self["nde", "", "nd", "Ndebele, North; North Ndebele", "ndébélé du Nord"],
318
+ self["ndo", "", "ng", "Ndonga", "ndonga"],
319
+ self["nds", "", "", "Low German; Low Saxon; German, Low; Saxon, Low", "bas allemand; bas saxon; allemand, bas; saxon, bas"],
320
+ self["nep", "", "ne", "Nepali", "népalais"],
321
+ self["new", "", "", "Nepal Bhasa; Newari", "nepal bhasa; newari"],
322
+ self["nia", "", "", "Nias", "nias"],
323
+ self["nic", "", "", "Niger-Kordofanian languages", "nigéro-kordofaniennes, langues"],
324
+ self["niu", "", "", "Niuean", "niué"],
325
+ self["nno", "", "nn", "Norwegian Nynorsk; Nynorsk, Norwegian", "norvégien nynorsk; nynorsk, norvégien"],
326
+ self["nob", "", "nb", "Bokmål, Norwegian; Norwegian Bokmål", "norvégien bokmål"],
327
+ self["nog", "", "", "Nogai", "nogaï; nogay"],
328
+ self["non", "", "", "Norse, Old", "norrois, vieux"],
329
+ self["nor", "", "no", "Norwegian", "norvégien"],
330
+ self["nqo", "", "", "N'Ko", "n'ko"],
331
+ self["nso", "", "", "Pedi; Sepedi; Northern Sotho", "pedi; sepedi; sotho du Nord"],
332
+ self["nub", "", "", "Nubian languages", "nubiennes, langues"],
333
+ self["nwc", "", "", "Classical Newari; Old Newari; Classical Nepal Bhasa", "newari classique"],
334
+ self["nya", "", "ny", "Chichewa; Chewa; Nyanja", "chichewa; chewa; nyanja"],
335
+ self["nym", "", "", "Nyamwezi", "nyamwezi"],
336
+ self["nyn", "", "", "Nyankole", "nyankolé"],
337
+ self["nyo", "", "", "Nyoro", "nyoro"],
338
+ self["nzi", "", "", "Nzima", "nzema"],
339
+ self["oci", "", "oc", "Occitan (post 1500); Provençal", "occitan (après 1500); provençal"],
340
+ self["oji", "", "oj", "Ojibwa", "ojibwa"],
341
+ self["ori", "", "or", "Oriya", "oriya"],
342
+ self["orm", "", "om", "Oromo", "galla"],
343
+ self["osa", "", "", "Osage", "osage"],
344
+ self["oss", "", "os", "Ossetian; Ossetic", "ossète"],
345
+ self["ota", "", "", "Turkish, Ottoman (1500-1928)", "turc ottoman (1500-1928)"],
346
+ self["oto", "", "", "Otomian languages", "otomi, langues"],
347
+ self["paa", "", "", "Papuan languages", "papoues, langues"],
348
+ self["pag", "", "", "Pangasinan", "pangasinan"],
349
+ self["pal", "", "", "Pahlavi", "pahlavi"],
350
+ self["pam", "", "", "Pampanga; Kapampangan", "pampangan"],
351
+ self["pan", "", "pa", "Panjabi; Punjabi", "pendjabi"],
352
+ self["pap", "", "", "Papiamento", "papiamento"],
353
+ self["pau", "", "", "Palauan", "palau"],
354
+ self["peo", "", "", "Persian, Old (ca.600-400 B.C.)", "perse, vieux (ca. 600-400 av. J.-C.)"],
355
+ self["per", "fas", "fa", "Persian", "persan"],
356
+ self["phi", "", "", "Philippine languages", "philippines, langues"],
357
+ self["phn", "", "", "Phoenician", "phénicien"],
358
+ self["pli", "", "pi", "Pali", "pali"],
359
+ self["pol", "", "pl", "Polish", "polonais"],
360
+ self["pon", "", "", "Pohnpeian", "pohnpei"],
361
+ self["por", "", "pt", "Portuguese", "portugais"],
362
+ self["pra", "", "", "Prakrit languages", "prâkrit, langues"],
363
+ self["pro", "", "", "Provençal, Old (to 1500)", "provençal ancien (jusqu'à 1500)"],
364
+ self["pus", "", "ps", "Pushto; Pashto", "pachto"],
365
+ self["qaa-qtz", "", "", "Reserved for local use", "réservée à l'usage local"],
366
+ self["que", "", "qu", "Quechua", "quechua"],
367
+ self["raj", "", "", "Rajasthani", "rajasthani"],
368
+ self["rap", "", "", "Rapanui", "rapanui"],
369
+ self["rar", "", "", "Rarotongan; Cook Islands Maori", "rarotonga; maori des îles Cook"],
370
+ self["roa", "", "", "Romance languages", "romanes, langues"],
371
+ self["roh", "", "rm", "Romansh", "romanche"],
372
+ self["rom", "", "", "Romany", "tsigane"],
373
+ self["rum", "ron", "ro", "Romanian; Moldavian; Moldovan", "roumain; moldave"],
374
+ self["run", "", "rn", "Rundi", "rundi"],
375
+ self["rup", "", "", "Aromanian; Arumanian; Macedo-Romanian", "aroumain; macédo-roumain"],
376
+ self["rus", "", "ru", "Russian", "russe"],
377
+ self["sad", "", "", "Sandawe", "sandawe"],
378
+ self["sag", "", "sg", "Sango", "sango"],
379
+ self["sah", "", "", "Yakut", "iakoute"],
380
+ self["sai", "", "", "South American Indian (Other)", "indiennes d'Amérique du Sud, autres langues"],
381
+ self["sal", "", "", "Salishan languages", "salishennes, langues"],
382
+ self["sam", "", "", "Samaritan Aramaic", "samaritain"],
383
+ self["san", "", "sa", "Sanskrit", "sanskrit"],
384
+ self["sas", "", "", "Sasak", "sasak"],
385
+ self["sat", "", "", "Santali", "santal"],
386
+ self["scn", "", "", "Sicilian", "sicilien"],
387
+ self["sco", "", "", "Scots", "écossais"],
388
+ self["sel", "", "", "Selkup", "selkoupe"],
389
+ self["sem", "", "", "Semitic languages", "sémitiques, langues"],
390
+ self["sga", "", "", "Irish, Old (to 900)", "irlandais ancien (jusqu'à 900)"],
391
+ self["sgn", "", "", "Sign Languages", "langues des signes"],
392
+ self["shn", "", "", "Shan", "chan"],
393
+ self["sid", "", "", "Sidamo", "sidamo"],
394
+ self["sin", "", "si", "Sinhala; Sinhalese", "singhalais"],
395
+ self["sio", "", "", "Siouan languages", "sioux, langues"],
396
+ self["sit", "", "", "Sino-Tibetan languages", "sino-tibétaines, langues"],
397
+ self["sla", "", "", "Slavic languages", "slaves, langues"],
398
+ self["slo", "slk", "sk", "Slovak", "slovaque"],
399
+ self["slv", "", "sl", "Slovenian", "slovène"],
400
+ self["sma", "", "", "Southern Sami", "sami du Sud"],
401
+ self["sme", "", "se", "Northern Sami", "sami du Nord"],
402
+ self["smi", "", "", "Sami languages", "sames, langues"],
403
+ self["smj", "", "", "Lule Sami", "sami de Lule"],
404
+ self["smn", "", "", "Inari Sami", "sami d'Inari"],
405
+ self["smo", "", "sm", "Samoan", "samoan"],
406
+ self["sms", "", "", "Skolt Sami", "sami skolt"],
407
+ self["sna", "", "sn", "Shona", "shona"],
408
+ self["snd", "", "sd", "Sindhi", "sindhi"],
409
+ self["snk", "", "", "Soninke", "soninké"],
410
+ self["sog", "", "", "Sogdian", "sogdien"],
411
+ self["som", "", "so", "Somali", "somali"],
412
+ self["son", "", "", "Songhai languages", "songhai, langues"],
413
+ self["sot", "", "st", "Sotho, Southern", "sotho du Sud"],
414
+ self["spa", "", "es", "Spanish; Castilian", "espagnol; castillan"],
415
+ self["srd", "", "sc", "Sardinian", "sarde"],
416
+ self["srn", "", "", "Sranan Tongo", "sranan tongo"],
417
+ self["srp", "", "sr", "Serbian", "serbe"],
418
+ self["srr", "", "", "Serer", "sérère"],
419
+ self["ssa", "", "", "Nilo-Saharan languages", "nilo-sahariennes, langues"],
420
+ self["ssw", "", "ss", "Swati", "swati"],
421
+ self["suk", "", "", "Sukuma", "sukuma"],
422
+ self["sun", "", "su", "Sundanese", "soundanais"],
423
+ self["sus", "", "", "Susu", "soussou"],
424
+ self["sux", "", "", "Sumerian", "sumérien"],
425
+ self["swa", "", "sw", "Swahili", "swahili"],
426
+ self["swe", "", "sv", "Swedish", "suédois"],
427
+ self["syc", "", "", "Classical Syriac", "syriaque classique"],
428
+ self["syr", "", "", "Syriac", "syriaque"],
429
+ self["tah", "", "ty", "Tahitian", "tahitien"],
430
+ self["tai", "", "", "Tai languages", "tai, langues"],
431
+ self["tam", "", "ta", "Tamil", "tamoul"],
432
+ self["tat", "", "tt", "Tatar", "tatar"],
433
+ self["tel", "", "te", "Telugu", "télougou"],
434
+ self["tem", "", "", "Timne", "temne"],
435
+ self["ter", "", "", "Tereno", "tereno"],
436
+ self["tet", "", "", "Tetum", "tetum"],
437
+ self["tgk", "", "tg", "Tajik", "tadjik"],
438
+ self["tgl", "", "tl", "Tagalog", "tagalog"],
439
+ self["tha", "", "th", "Thai", "thaï"],
440
+ self["tib", "bod", "bo", "Tibetan", "tibétain"],
441
+ self["tig", "", "", "Tigre", "tigré"],
442
+ self["tir", "", "ti", "Tigrinya", "tigrigna"],
443
+ self["tiv", "", "", "Tiv", "tiv"],
444
+ self["tkl", "", "", "Tokelau", "tokelau"],
445
+ self["tlh", "", "", "Klingon; tlhIngan-Hol", "klingon"],
446
+ self["tli", "", "", "Tlingit", "tlingit"],
447
+ self["tmh", "", "", "Tamashek", "tamacheq"],
448
+ self["tog", "", "", "Tonga (Nyasa)", "tonga (Nyasa)"],
449
+ self["ton", "", "to", "Tonga (Tonga Islands)", "tongan (Îles Tonga)"],
450
+ self["tpi", "", "", "Tok Pisin", "tok pisin"],
451
+ self["tsi", "", "", "Tsimshian", "tsimshian"],
452
+ self["tsn", "", "tn", "Tswana", "tswana"],
453
+ self["tso", "", "ts", "Tsonga", "tsonga"],
454
+ self["tuk", "", "tk", "Turkmen", "turkmène"],
455
+ self["tum", "", "", "Tumbuka", "tumbuka"],
456
+ self["tup", "", "", "Tupi languages", "tupi, langues"],
457
+ self["tur", "", "tr", "Turkish", "turc"],
458
+ self["tut", "", "", "Altaic languages", "altaïques, langues"],
459
+ self["tvl", "", "", "Tuvalu", "tuvalu"],
460
+ self["twi", "", "tw", "Twi", "twi"],
461
+ self["tyv", "", "", "Tuvinian", "touva"],
462
+ self["udm", "", "", "Udmurt", "oudmourte"],
463
+ self["uga", "", "", "Ugaritic", "ougaritique"],
464
+ self["uig", "", "ug", "Uighur; Uyghur", "ouïgour"],
465
+ self["ukr", "", "uk", "Ukrainian", "ukrainien"],
466
+ self["umb", "", "", "Umbundu", "umbundu"],
467
+ self["und", "", "", "Undetermined", "indéterminée"],
468
+ self["urd", "", "ur", "Urdu", "ourdou"],
469
+ self["uzb", "", "uz", "Uzbek", "ouszbek"],
470
+ self["vai", "", "", "Vai", "vaï"],
471
+ self["ven", "", "ve", "Venda", "venda"],
472
+ self["vie", "", "vi", "Vietnamese", "vietnamien"],
473
+ self["vol", "", "vo", "Volapük", "volapük"],
474
+ self["vot", "", "", "Votic", "vote"],
475
+ self["wak", "", "", "Wakashan languages", "wakashanes, langues"],
476
+ self["wal", "", "", "Walamo", "walamo"],
477
+ self["war", "", "", "Waray", "waray"],
478
+ self["was", "", "", "Washo", "washo"],
479
+ self["wel", "cym", "cy", "Welsh", "gallois"],
480
+ self["wen", "", "", "Sorbian languages", "sorabes, langues"],
481
+ self["wln", "", "wa", "Walloon", "wallon"],
482
+ self["wol", "", "wo", "Wolof", "wolof"],
483
+ self["xal", "", "", "Kalmyk; Oirat", "kalmouk; oïrat"],
484
+ self["xho", "", "xh", "Xhosa", "xhosa"],
485
+ self["yao", "", "", "Yao", "yao"],
486
+ self["yap", "", "", "Yapese", "yapois"],
487
+ self["yid", "", "yi", "Yiddish", "yiddish"],
488
+ self["yor", "", "yo", "Yoruba", "yoruba"],
489
+ self["ypk", "", "", "Yupik languages", "yupik, langues"],
490
+ self["zap", "", "", "Zapotec", "zapotèque"],
491
+ self["zbl", "", "", "Blissymbols; Blissymbolics; Bliss", "symboles Bliss; Bliss"],
492
+ self["zen", "", "", "Zenaga", "zenaga"],
493
+ self["zha", "", "za", "Zhuang; Chuang", "zhuang; chuang"],
494
+ self["znd", "", "", "Zande languages", "zandé, langues"],
495
+ self["zul", "", "zu", "Zulu", "zoulou"],
496
+ self["zun", "", "", "Zuni", "zuni"],
497
+ self["zxx", "", "", "No linguistic content; Not applicable", "pas de contenu linguistique; non applicable"],
498
+ self["zza", "", "", "Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki", "zaza; dimili; dimli; kirdki; kirmanjki; zazaki"]
499
+ ]
500
+
501
+ # The ISO 639-1 dataset as an array of entries. Each entry is an array with
502
+ # the following format:
503
+ # * [0]: an ISO 369-2 alpha-3 (bibliographic) code
504
+ # * [1]: an ISO 369-2 alpha-3 (terminologic) code (when given)
505
+ # * [2]: an ISO 369-1 alpha-2 code (when given)
506
+ # * [3]: an English name
507
+ # * [4]: a French name
508
+ ISO_639_1 = ISO_639_2.collect do |entry|
509
+ entry unless entry[2].empty?
510
+ end.compact
511
+
512
+ class << self
513
+ # Returns the entry array for an alpha-2 or alpha-3 code
514
+ def find_by_code(code)
515
+ case code.length
516
+ when 3
517
+ ISO_639_2.detect { |entry| entry if entry.alpha3 == code }
518
+ when 2
519
+ ISO_639_1.detect { |entry| entry if entry.alpha2 == code }
520
+ end
521
+ end
522
+ alias_method :find, :find_by_code
523
+
524
+ # Returns the entry array for a language specified by its English name.
525
+ def find_by_english_name(name)
526
+ ISO_639_2.detect { |entry| entry if entry.english_name == name }
527
+ end
528
+
529
+ # Returns the entry array for a language specified by its French name.
530
+ def find_by_french_name(name)
531
+ ISO_639_2.detect { |entry| entry if entry.french_name == name }
532
+ end
533
+ end
534
+
535
+ # The entry's alpha-3 bibliotigraphic code.
536
+ def alpha3_bibliographic; self[0] end
537
+ alias_method :alpha3, :alpha3_bibliographic
538
+ # The entry's alpha-3 terminologic (when given)
539
+ def alpha3_terminologic; self[1] end
540
+ # The entry's alpha-2 code (when given)
541
+ def alpha2; self[2] end
542
+ # The entry's english name.
543
+ def english_name; self[3] end
544
+ # The entry's french name.
545
+ def french_name; self[4] end
546
+
547
+ end
@@ -0,0 +1,41 @@
1
+ require 'test_helper'
2
+
3
+ class TestISO639 < Test::Unit::TestCase
4
+
5
+ should "have full code list in ISO_639_2" do
6
+ assert_equal 485, ISO_639::ISO_639_2.length
7
+ end
8
+
9
+ should "have shorter code list in ISO_639_1" do
10
+ assert_equal 184, ISO_639::ISO_639_1.length
11
+ end
12
+
13
+ should "return entry for alpha-2 code" do
14
+ assert_equal ["eng", "", "en", "English", "anglais"], ISO_639.find_by_code("en")
15
+ assert_equal ["eng", "", "en", "English", "anglais"], ISO_639.find("en")
16
+ end
17
+
18
+ should "find by english name" do
19
+ assert_equal ["eng", "", "en", "English", "anglais"], ISO_639.find_by_english_name("English")
20
+ end
21
+
22
+ should "find by french name" do
23
+ assert_equal ["eng", "", "en", "English", "anglais"], ISO_639.find_by_french_name("anglais")
24
+ end
25
+
26
+ %w[
27
+ alpha3_bibliographic
28
+ alpha3
29
+ alpha3_terminologic
30
+ alpha2
31
+ english_name
32
+ french_name
33
+ ].each_with_index do |m, i|
34
+ should "respond to and return #{m}" do
35
+ @entry = ISO_639.find("en")
36
+ assert @entry.respond_to?(m)
37
+ assert_equal ["eng", "eng", "", "en", "English", "anglais"][i], @entry.send(m)
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'iso-639'
8
+
9
+ class Test::Unit::TestCase
10
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iso-639
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - William Melody
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-20 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thoughtbot-shoulda
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: ISO 639-1 and ISO 639-2 language code entries and convenience methods
26
+ email: hi@williammelody.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.md
34
+ files:
35
+ - .document
36
+ - .gitignore
37
+ - LICENSE
38
+ - README.md
39
+ - Rakefile
40
+ - VERSION
41
+ - iso-639.gemspec
42
+ - lib/iso-639.rb
43
+ - test/test_ISO_639.rb
44
+ - test/test_helper.rb
45
+ has_rdoc: true
46
+ homepage: http://github.com/autodata/iso-639
47
+ licenses: []
48
+
49
+ post_install_message:
50
+ rdoc_options:
51
+ - --charset=UTF-8
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ requirements: []
67
+
68
+ rubyforge_project:
69
+ rubygems_version: 1.3.5
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: ISO 639-1 and ISO 639-2 language code entries and convenience methods
73
+ test_files:
74
+ - test/test_helper.rb
75
+ - test/test_ISO_639.rb