human_languages 0.10.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/CONTRIBUTING.adoc +46 -0
- data/Gemfile +7 -3
- data/Gemfile.lock +97 -21
- data/LICENSE +1 -1
- data/README.adoc +13 -1
- data/REUSE.toml +1 -1
- data/Steepfile +8 -0
- data/data/iso-639-3.tsv +9 -5
- data/data/iso-639-5.tsv +116 -0
- data/lib/languages/constants.rb +1 -1
- data/lib/languages/language.rb +21 -8
- data/lib/languages/language_family.rb +36 -0
- data/lib/languages/version.rb +1 -1
- data/lib/languages.rb +27 -23
- data/sig/languages.rbs +39 -11
- metadata +9 -4
- data/human_languages.gemspec +0 -42
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c6f8a468e1f1424991e7ba66c85d362c7ddb20774e4e3cd3b2312926c54b063
|
|
4
|
+
data.tar.gz: 5e26a27bc4c68372877f02a2d586e8c459d379acfde40d96e852f641a50cea0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72b2216630ac5b66d0162955c9374ba9bec5d90d48e5d024143b3245345b0150c0188b4f7983016d06e390fff6c8ce220f80170fc0da2957590026c330df8223
|
|
7
|
+
data.tar.gz: 5f6e7a538ab705fd621271318885cfc0996e7aec15dc0d18dcbba60c32bcc36e8e2bef8e3a0a33071ded4e3532d5a8d675135dea41dce177c641793cc2e6573b
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.0] - 2026-04-15
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `Languages::LanguageFamily` class representing ISO 639-5 collective language codes (families and groups), with English (`name`) and French (`name_fr`) reference names
|
|
15
|
+
- `Languages.language_families` returning all 115 ISO 639-5 entries
|
|
16
|
+
- `Languages[]` now resolves ISO 639-5 codes (e.g. `Languages[:myn]` returns the Mayan languages family)
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- `Language#<=>` now sorts ascending by ISO 639-3 code (was reversed)
|
|
21
|
+
- RBS signatures: `Language#scope` and `Language#type` corrected from `String` to `Symbol?`
|
|
22
|
+
|
|
23
|
+
### Removed
|
|
24
|
+
|
|
25
|
+
- `Languages.ancient` (deprecated since v0.9.0; the ancient language type was removed by the ISO 639-3 maintenance agency)
|
|
26
|
+
- Support for Ruby 3.2
|
|
27
|
+
|
|
10
28
|
## [0.10.1] - 2025-08-12
|
|
11
29
|
|
|
12
30
|
### Fixed
|
data/CONTRIBUTING.adoc
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
= Contributing
|
|
2
|
+
Benno Bielmeier
|
|
3
|
+
|
|
4
|
+
== Setup
|
|
5
|
+
|
|
6
|
+
....
|
|
7
|
+
$ git clone https://github.com/bbenno/languages.git
|
|
8
|
+
$ cd languages
|
|
9
|
+
$ bin/setup
|
|
10
|
+
....
|
|
11
|
+
|
|
12
|
+
Alternatively, use https://devenv.sh[devenv] (Nix) for a reproducible environment:
|
|
13
|
+
|
|
14
|
+
....
|
|
15
|
+
$ devenv shell
|
|
16
|
+
....
|
|
17
|
+
|
|
18
|
+
Run tests and linter:
|
|
19
|
+
|
|
20
|
+
....
|
|
21
|
+
$ bundle exec rake
|
|
22
|
+
....
|
|
23
|
+
|
|
24
|
+
Run type checking:
|
|
25
|
+
|
|
26
|
+
....
|
|
27
|
+
$ bundle exec steep check
|
|
28
|
+
....
|
|
29
|
+
|
|
30
|
+
Test coverage is measured with https://github.com/simplecov-ruby/simplecov[SimpleCov] and reported after each `rake test` run.
|
|
31
|
+
Coverage output is written to `coverage/`.
|
|
32
|
+
|
|
33
|
+
== Updating ISO 639 data
|
|
34
|
+
|
|
35
|
+
....
|
|
36
|
+
$ bin/update-data
|
|
37
|
+
....
|
|
38
|
+
|
|
39
|
+
== Submitting changes
|
|
40
|
+
|
|
41
|
+
. Open an issue before starting non-trivial work.
|
|
42
|
+
. Fork, branch, and commit using https://www.conventionalcommits.org[Conventional Commits].
|
|
43
|
+
. Update `CHANGELOG.md` under `[Unreleased]`.
|
|
44
|
+
. Open a pull request against `master`.
|
|
45
|
+
|
|
46
|
+
Bug reports and pull requests are welcome at https://github.com/bbenno/languages.
|
data/Gemfile
CHANGED
|
@@ -5,8 +5,12 @@ source 'https://rubygems.org'
|
|
|
5
5
|
# Specify your gem's dependencies in languages.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem '
|
|
8
|
+
gem 'asciidoctor', '~> 2.0', require: false # required by yard to render README.adoc
|
|
9
|
+
gem 'minitest', '~> 6.0'
|
|
9
10
|
gem 'rake', '~> 13.3'
|
|
10
|
-
gem 'rubocop', '~> 1.
|
|
11
|
-
gem 'rubocop-minitest', '~> 0.
|
|
11
|
+
gem 'rubocop', '~> 1.86'
|
|
12
|
+
gem 'rubocop-minitest', '~> 0.39.1'
|
|
12
13
|
gem 'rubocop-rake', '~> 0.7.1'
|
|
14
|
+
gem 'simplecov', '~> 0.22', require: false # test coverage; output written to coverage/
|
|
15
|
+
gem 'steep', '~> 1.0', require: false # static type checking against sig/*.rbs
|
|
16
|
+
gem 'yard', '~> 0.9' # API doc generation; deployed via GitHub Pages
|
data/Gemfile.lock
CHANGED
|
@@ -1,40 +1,80 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
human_languages (0.
|
|
4
|
+
human_languages (1.0.0)
|
|
5
|
+
csv (~> 3.0)
|
|
5
6
|
|
|
6
7
|
GEM
|
|
7
8
|
remote: https://rubygems.org/
|
|
8
9
|
specs:
|
|
10
|
+
activesupport (8.1.3)
|
|
11
|
+
base64
|
|
12
|
+
bigdecimal
|
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
14
|
+
connection_pool (>= 2.2.5)
|
|
15
|
+
drb
|
|
16
|
+
i18n (>= 1.6, < 2)
|
|
17
|
+
json
|
|
18
|
+
logger (>= 1.4.2)
|
|
19
|
+
minitest (>= 5.1)
|
|
20
|
+
securerandom (>= 0.3)
|
|
21
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
22
|
+
uri (>= 0.13.1)
|
|
23
|
+
asciidoctor (2.0.26)
|
|
9
24
|
ast (2.4.3)
|
|
10
|
-
|
|
25
|
+
base64 (0.3.0)
|
|
26
|
+
bigdecimal (4.1.1)
|
|
27
|
+
concurrent-ruby (1.3.6)
|
|
28
|
+
connection_pool (3.0.2)
|
|
29
|
+
csv (3.3.5)
|
|
30
|
+
docile (1.4.1)
|
|
31
|
+
drb (2.2.3)
|
|
32
|
+
ffi (1.17.4-x86_64-linux-gnu)
|
|
33
|
+
fileutils (1.8.0)
|
|
34
|
+
i18n (1.14.8)
|
|
35
|
+
concurrent-ruby (~> 1.0)
|
|
36
|
+
json (2.19.3)
|
|
11
37
|
language_server-protocol (3.17.0.5)
|
|
12
38
|
lint_roller (1.1.0)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
listen (3.10.0)
|
|
40
|
+
logger
|
|
41
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
42
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
|
43
|
+
logger (1.7.0)
|
|
44
|
+
minitest (6.0.4)
|
|
45
|
+
drb (~> 2.0)
|
|
46
|
+
prism (~> 1.5)
|
|
47
|
+
mutex_m (0.3.0)
|
|
48
|
+
parallel (2.0.1)
|
|
49
|
+
parser (3.3.11.1)
|
|
16
50
|
ast (~> 2.4.1)
|
|
17
51
|
racc
|
|
18
|
-
prism (1.
|
|
52
|
+
prism (1.9.0)
|
|
19
53
|
racc (1.8.1)
|
|
20
54
|
rainbow (3.1.1)
|
|
21
|
-
rake (13.
|
|
22
|
-
|
|
23
|
-
|
|
55
|
+
rake (13.4.1)
|
|
56
|
+
rb-fsevent (0.11.2)
|
|
57
|
+
rb-inotify (0.11.1)
|
|
58
|
+
ffi (~> 1.0)
|
|
59
|
+
rbs (3.10.4)
|
|
60
|
+
logger
|
|
61
|
+
tsort
|
|
62
|
+
regexp_parser (2.12.0)
|
|
63
|
+
rubocop (1.86.1)
|
|
24
64
|
json (~> 2.3)
|
|
25
65
|
language_server-protocol (~> 3.17.0.2)
|
|
26
66
|
lint_roller (~> 1.1.0)
|
|
27
|
-
parallel (
|
|
67
|
+
parallel (>= 1.10)
|
|
28
68
|
parser (>= 3.3.0.2)
|
|
29
69
|
rainbow (>= 2.2.2, < 4.0)
|
|
30
70
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
31
|
-
rubocop-ast (>= 1.
|
|
71
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
32
72
|
ruby-progressbar (~> 1.7)
|
|
33
73
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
34
|
-
rubocop-ast (1.
|
|
74
|
+
rubocop-ast (1.49.1)
|
|
35
75
|
parser (>= 3.3.7.2)
|
|
36
|
-
prism (~> 1.
|
|
37
|
-
rubocop-minitest (0.
|
|
76
|
+
prism (~> 1.7)
|
|
77
|
+
rubocop-minitest (0.39.1)
|
|
38
78
|
lint_roller (~> 1.1)
|
|
39
79
|
rubocop (>= 1.75.0, < 2.0)
|
|
40
80
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
@@ -42,20 +82,56 @@ GEM
|
|
|
42
82
|
lint_roller (~> 1.1)
|
|
43
83
|
rubocop (>= 1.72.1)
|
|
44
84
|
ruby-progressbar (1.13.0)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
85
|
+
securerandom (0.4.1)
|
|
86
|
+
simplecov (0.22.0)
|
|
87
|
+
docile (~> 1.1)
|
|
88
|
+
simplecov-html (~> 0.11)
|
|
89
|
+
simplecov_json_formatter (~> 0.1)
|
|
90
|
+
simplecov-html (0.13.2)
|
|
91
|
+
simplecov_json_formatter (0.1.4)
|
|
92
|
+
steep (1.10.0)
|
|
93
|
+
activesupport (>= 5.1)
|
|
94
|
+
concurrent-ruby (>= 1.1.10)
|
|
95
|
+
csv (>= 3.0.9)
|
|
96
|
+
fileutils (>= 1.1.0)
|
|
97
|
+
json (>= 2.1.0)
|
|
98
|
+
language_server-protocol (>= 3.17.0.4, < 4.0)
|
|
99
|
+
listen (~> 3.0)
|
|
100
|
+
logger (>= 1.3.0)
|
|
101
|
+
mutex_m (>= 0.3.0)
|
|
102
|
+
parser (>= 3.1)
|
|
103
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
104
|
+
rbs (~> 3.9)
|
|
105
|
+
securerandom (>= 0.1)
|
|
106
|
+
strscan (>= 1.0.0)
|
|
107
|
+
terminal-table (>= 2, < 5)
|
|
108
|
+
uri (>= 0.12.0)
|
|
109
|
+
strscan (3.1.8)
|
|
110
|
+
terminal-table (4.0.0)
|
|
111
|
+
unicode-display_width (>= 1.1.1, < 4)
|
|
112
|
+
tsort (0.2.0)
|
|
113
|
+
tzinfo (2.0.6)
|
|
114
|
+
concurrent-ruby (~> 1.0)
|
|
115
|
+
unicode-display_width (3.2.0)
|
|
116
|
+
unicode-emoji (~> 4.1)
|
|
117
|
+
unicode-emoji (4.2.0)
|
|
118
|
+
uri (1.1.1)
|
|
119
|
+
yard (0.9.41)
|
|
48
120
|
|
|
49
121
|
PLATFORMS
|
|
50
122
|
x86_64-linux
|
|
51
123
|
|
|
52
124
|
DEPENDENCIES
|
|
125
|
+
asciidoctor (~> 2.0)
|
|
53
126
|
human_languages!
|
|
54
|
-
minitest (~>
|
|
127
|
+
minitest (~> 6.0)
|
|
55
128
|
rake (~> 13.3)
|
|
56
|
-
rubocop (~> 1.
|
|
57
|
-
rubocop-minitest (~> 0.
|
|
129
|
+
rubocop (~> 1.86)
|
|
130
|
+
rubocop-minitest (~> 0.39.1)
|
|
58
131
|
rubocop-rake (~> 0.7.1)
|
|
132
|
+
simplecov (~> 0.22)
|
|
133
|
+
steep (~> 1.0)
|
|
134
|
+
yard (~> 0.9)
|
|
59
135
|
|
|
60
136
|
BUNDLED WITH
|
|
61
|
-
2.
|
|
137
|
+
2.7.2
|
data/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright 2022-
|
|
1
|
+
Copyright 2022-2026 Benno Bielmeier
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
data/README.adoc
CHANGED
|
@@ -51,12 +51,18 @@ russian = Languages['Russian'] # Languages can be retrieved via reference name,
|
|
|
51
51
|
klingon = Languages['KLINgon'] # weird casing, but still works
|
|
52
52
|
|
|
53
53
|
invalid = Languages[:invalid] # invalid or unknown names or ISO codes returns nil
|
|
54
|
+
|
|
55
|
+
mayan = Languages[:myn] # ISO 639-5 collective codes are supported too
|
|
54
56
|
----
|
|
55
57
|
|
|
56
58
|
.Get all ISO 639-3 languages
|
|
57
59
|
[source]
|
|
58
60
|
Languages.all
|
|
59
61
|
|
|
62
|
+
.Get all ISO 639-5 language families and groups
|
|
63
|
+
[source]
|
|
64
|
+
Languages.language_families
|
|
65
|
+
|
|
60
66
|
.Get languages by name (regexp search)
|
|
61
67
|
[source]
|
|
62
68
|
----
|
|
@@ -133,41 +139,47 @@ macrolanguage.macrolanguage # => nil
|
|
|
133
139
|
Why to build another gem for ISO 639?
|
|
134
140
|
|
|
135
141
|
.Overview
|
|
136
|
-
[%header,cols="2,1,2,2,3"]
|
|
142
|
+
[%header,cols="2,1,2,2,2,3"]
|
|
137
143
|
|===
|
|
138
144
|
|Gem
|
|
139
145
|
|ISO 639-1/-2
|
|
140
146
|
|ISO 639-3
|
|
147
|
+
|ISO 639-5
|
|
141
148
|
|Translations
|
|
142
149
|
|Data Storage
|
|
143
150
|
|
|
144
151
|
|https://rubygems.org/gems/iso639[iso639]
|
|
145
152
|
|✅
|
|
146
153
|
|❌
|
|
154
|
+
|✅
|
|
147
155
|
|French
|
|
148
156
|
|Collection of Hashes
|
|
149
157
|
|
|
150
158
|
|https://rubygems.org/gems/iso-639[iso-639]
|
|
151
159
|
|✅
|
|
152
160
|
|❌
|
|
161
|
+
|✅
|
|
153
162
|
|French
|
|
154
163
|
|Array of Arrays
|
|
155
164
|
|
|
156
165
|
|https://rubygems.org/gems/iso-639-data[iso-639-data]
|
|
157
166
|
|✅
|
|
158
167
|
|(✅) only scope individual
|
|
168
|
+
|✅
|
|
159
169
|
|French for ISO 639-2
|
|
160
170
|
|Hash of Hashes
|
|
161
171
|
|
|
162
172
|
|https://rubygems.org/gems/language_list[language_list]
|
|
163
173
|
|✅
|
|
164
174
|
|(✅) only scope individual
|
|
175
|
+
|❌
|
|
165
176
|
|-
|
|
166
177
|
|Array of Language-Objects
|
|
167
178
|
|
|
168
179
|
|https://rubygems.org/gems/human_languages[human_languages]
|
|
169
180
|
|✅
|
|
170
181
|
|✅
|
|
182
|
+
|✅
|
|
171
183
|
|-
|
|
172
184
|
|Array of Language-Objects
|
|
173
185
|
|===
|
data/REUSE.toml
CHANGED
|
@@ -6,7 +6,7 @@ SPDX-PackageDownloadLocation = "https://github.com/bbenno/languages"
|
|
|
6
6
|
[[annotations]]
|
|
7
7
|
path = "**"
|
|
8
8
|
precedence = "aggregate"
|
|
9
|
-
SPDX-FileCopyrightText = "2022-
|
|
9
|
+
SPDX-FileCopyrightText = "2022-2026 Benno Bielmeier <git@bbenno.com>"
|
|
10
10
|
SPDX-License-Identifier = "MIT"
|
|
11
11
|
|
|
12
12
|
[[annotations]]
|
data/Steepfile
ADDED
data/data/iso-639-3.tsv
CHANGED
|
@@ -850,7 +850,7 @@ bnz I L Beezen
|
|
|
850
850
|
boa I L Bora
|
|
851
851
|
bob I L Aweer
|
|
852
852
|
bod tib bod bo I L Tibetan
|
|
853
|
-
boe I L Mundabli
|
|
853
|
+
boe I L Mundabli-Mufu
|
|
854
854
|
bof I L Bolon
|
|
855
855
|
bog I L Bamako Sign Language
|
|
856
856
|
boh I L Boma
|
|
@@ -1590,7 +1590,7 @@ diq I L Dimli (individual language)
|
|
|
1590
1590
|
dir I L Dirim
|
|
1591
1591
|
dis I L Dimasa
|
|
1592
1592
|
diu I L Diriku
|
|
1593
|
-
div div div dv I L
|
|
1593
|
+
div div div dv I L Dhivehi
|
|
1594
1594
|
diw I L Northwestern Dinka
|
|
1595
1595
|
dix I L Dixon Reef
|
|
1596
1596
|
diy I L Diuwe
|
|
@@ -1751,6 +1751,7 @@ dyb I E Dyaberdyaber
|
|
|
1751
1751
|
dyd I E Dyugun
|
|
1752
1752
|
dyg I E Villa Viciosa Agta
|
|
1753
1753
|
dyi I L Djimini Senoufo
|
|
1754
|
+
dyl I L Bhutanese Sign Language
|
|
1754
1755
|
dym I L Yanda Dom Dogon
|
|
1755
1756
|
dyn I L Dyangadi
|
|
1756
1757
|
dyo I L Jola-Fonyi
|
|
@@ -3573,6 +3574,7 @@ lex I L Luang
|
|
|
3573
3574
|
ley I L Lemolang
|
|
3574
3575
|
lez lez lez I L Lezghian
|
|
3575
3576
|
lfa I L Lefa
|
|
3577
|
+
lfb I L Buu (Cameroon)
|
|
3576
3578
|
lfn I C Lingua Franca Nova
|
|
3577
3579
|
lga I L Lungga
|
|
3578
3580
|
lgb I L Laghu
|
|
@@ -3784,7 +3786,7 @@ lue I L Luvale
|
|
|
3784
3786
|
luf I L Laua
|
|
3785
3787
|
lug lug lug lg I L Ganda
|
|
3786
3788
|
luh I L Leizhou Chinese
|
|
3787
|
-
lui lui lui I E
|
|
3789
|
+
lui lui lui I E Luiseño
|
|
3788
3790
|
luj I L Luna
|
|
3789
3791
|
luk I L Lunanakha
|
|
3790
3792
|
lul I L Olu'bo
|
|
@@ -5018,6 +5020,7 @@ okv I L Orokaiva
|
|
|
5018
5020
|
okx I L Okpe (Northwestern Edo)
|
|
5019
5021
|
okz I H Old Khmer
|
|
5020
5022
|
ola I L Walungge
|
|
5023
|
+
olb I L Oli-Bodiman
|
|
5021
5024
|
old I L Mochi
|
|
5022
5025
|
ole I L Olekha
|
|
5023
5026
|
olk I E Olkol
|
|
@@ -5089,11 +5092,12 @@ ory I L Odia
|
|
|
5089
5092
|
orz I L Ormu
|
|
5090
5093
|
osa osa osa I L Osage
|
|
5091
5094
|
osc I H Oscan
|
|
5095
|
+
osd I L Digor Ossetic
|
|
5092
5096
|
osi I L Osing
|
|
5093
5097
|
osn I H Old Sundanese
|
|
5094
5098
|
oso I L Ososo
|
|
5095
5099
|
osp I H Old Spanish
|
|
5096
|
-
oss oss oss os I L
|
|
5100
|
+
oss oss oss os I L Iron Ossetic
|
|
5097
5101
|
ost I L Osatu
|
|
5098
5102
|
osu I L Southern One
|
|
5099
5103
|
osx I H Old Saxon
|
|
@@ -5759,6 +5763,7 @@ scu I L Shumcho
|
|
|
5759
5763
|
scv I L Sheni
|
|
5760
5764
|
scw I L Sha
|
|
5761
5765
|
scx I H Sicel
|
|
5766
|
+
scz I L Shaetlan
|
|
5762
5767
|
sda I L Toraja-Sa'dan
|
|
5763
5768
|
sdb I L Shabak
|
|
5764
5769
|
sdc I L Sassarese Sardinian
|
|
@@ -7652,7 +7657,6 @@ yob I E Yoba
|
|
|
7652
7657
|
yog I L Yogad
|
|
7653
7658
|
yoi I L Yonaguni
|
|
7654
7659
|
yok I L Yokuts
|
|
7655
|
-
yol I E Yola
|
|
7656
7660
|
yom I L Yombe
|
|
7657
7661
|
yon I L Yongkom
|
|
7658
7662
|
yor yor yor yo I L Yoruba
|
data/data/iso-639-5.tsv
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
URI code Label (English) Label (French)
|
|
2
|
+
http://id.loc.gov/vocabulary/iso639-5/aav aav Austro-Asiatic languages austro-asiatiques, langues
|
|
3
|
+
http://id.loc.gov/vocabulary/iso639-5/afa afa Afro-Asiatic languages afro-asiatiques, langues
|
|
4
|
+
http://id.loc.gov/vocabulary/iso639-5/alg alg Algonquian languages algonquines, langues
|
|
5
|
+
http://id.loc.gov/vocabulary/iso639-5/alv alv Atlantic-Congo languages atlantique-congo, langues
|
|
6
|
+
http://id.loc.gov/vocabulary/iso639-5/apa apa Apache languages apaches, langues
|
|
7
|
+
http://id.loc.gov/vocabulary/iso639-5/aqa aqa Alacalufan languages alacalufanes, langues
|
|
8
|
+
http://id.loc.gov/vocabulary/iso639-5/aql aql Algic languages algiques, langues
|
|
9
|
+
http://id.loc.gov/vocabulary/iso639-5/art art Artificial languages artificielles, langues
|
|
10
|
+
http://id.loc.gov/vocabulary/iso639-5/ath ath Athapascan languages athapascanes, langues
|
|
11
|
+
http://id.loc.gov/vocabulary/iso639-5/auf auf Arauan languages arauanes, langues
|
|
12
|
+
http://id.loc.gov/vocabulary/iso639-5/aus aus Australian languages australiennes, langues
|
|
13
|
+
http://id.loc.gov/vocabulary/iso639-5/awd awd Arawakan languages arawak, langues
|
|
14
|
+
http://id.loc.gov/vocabulary/iso639-5/azc azc Uto-Aztecan languages uto-aztèques, langues
|
|
15
|
+
http://id.loc.gov/vocabulary/iso639-5/bad bad Banda languages banda, langues
|
|
16
|
+
http://id.loc.gov/vocabulary/iso639-5/bai bai Bamileke languages bamiléké, langues
|
|
17
|
+
http://id.loc.gov/vocabulary/iso639-5/bat bat Baltic languages baltes, langues
|
|
18
|
+
http://id.loc.gov/vocabulary/iso639-5/ber ber Berber languages berbères, langues
|
|
19
|
+
http://id.loc.gov/vocabulary/iso639-5/bih bih Bihari languages langues biharis
|
|
20
|
+
http://id.loc.gov/vocabulary/iso639-5/bnt bnt Bantu languages bantou, langues
|
|
21
|
+
http://id.loc.gov/vocabulary/iso639-5/btk btk Batak languages batak, langues
|
|
22
|
+
http://id.loc.gov/vocabulary/iso639-5/cai cai Central American Indian languages amérindiennes de l'Amérique centrale, langues
|
|
23
|
+
http://id.loc.gov/vocabulary/iso639-5/cau cau Caucasian languages caucasiennes, langues
|
|
24
|
+
http://id.loc.gov/vocabulary/iso639-5/cba cba Chibchan languages chibcha, langues
|
|
25
|
+
http://id.loc.gov/vocabulary/iso639-5/ccn ccn North Caucasian languages caucasiennes du Nord, langues
|
|
26
|
+
http://id.loc.gov/vocabulary/iso639-5/ccs ccs South Caucasian languages caucasiennes du Sud, langues
|
|
27
|
+
http://id.loc.gov/vocabulary/iso639-5/cdc cdc Chadic languages tchadiques, langues
|
|
28
|
+
http://id.loc.gov/vocabulary/iso639-5/cdd cdd Caddoan languages caddoanes, langues
|
|
29
|
+
http://id.loc.gov/vocabulary/iso639-5/cel cel Celtic languages celtiques, langues; celtes, langues
|
|
30
|
+
http://id.loc.gov/vocabulary/iso639-5/cmc cmc Chamic languages chames, langues
|
|
31
|
+
http://id.loc.gov/vocabulary/iso639-5/cpe cpe Creoles and pidgins, English‑based créoles et pidgins basés sur l'anglais
|
|
32
|
+
http://id.loc.gov/vocabulary/iso639-5/cpf cpf Creoles and pidgins, French‑based créoles et pidgins basés sur le français
|
|
33
|
+
http://id.loc.gov/vocabulary/iso639-5/cpp cpp Creoles and pidgins, Portuguese-based créoles et pidgins basés sur le portugais
|
|
34
|
+
http://id.loc.gov/vocabulary/iso639-5/crp crp Creoles and pidgins créoles et pidgins
|
|
35
|
+
http://id.loc.gov/vocabulary/iso639-5/csu csu Central Sudanic languages soudaniques centrales, langues
|
|
36
|
+
http://id.loc.gov/vocabulary/iso639-5/cus cus Cushitic languages couchitiques, langues
|
|
37
|
+
http://id.loc.gov/vocabulary/iso639-5/day day Land Dayak languages dayak, langues
|
|
38
|
+
http://id.loc.gov/vocabulary/iso639-5/dmn dmn Mande languages mandé, langues
|
|
39
|
+
http://id.loc.gov/vocabulary/iso639-5/dra dra Dravidian languages dravidiennes, langues
|
|
40
|
+
http://id.loc.gov/vocabulary/iso639-5/egx egx Egyptian languages égyptiennes, langues
|
|
41
|
+
http://id.loc.gov/vocabulary/iso639-5/esx esx Eskimo-Aleut languages esquimaudes-aléoutiennes, langues
|
|
42
|
+
http://id.loc.gov/vocabulary/iso639-5/euq euq Basque (family) basque (famille)
|
|
43
|
+
http://id.loc.gov/vocabulary/iso639-5/fiu fiu Finno-Ugrian languages finno-ougriennes, langues
|
|
44
|
+
http://id.loc.gov/vocabulary/iso639-5/fox fox Formosan languages formosanes, langues
|
|
45
|
+
http://id.loc.gov/vocabulary/iso639-5/gem gem Germanic languages germaniques, langues
|
|
46
|
+
http://id.loc.gov/vocabulary/iso639-5/gme gme East Germanic languages germaniques orientales, langues
|
|
47
|
+
http://id.loc.gov/vocabulary/iso639-5/gmq gmq North Germanic languages germaniques septentrionales, langues
|
|
48
|
+
http://id.loc.gov/vocabulary/iso639-5/gmw gmw West Germanic languages germaniques occidentales, langues
|
|
49
|
+
http://id.loc.gov/vocabulary/iso639-5/grk grk Greek languages grecques, langues
|
|
50
|
+
http://id.loc.gov/vocabulary/iso639-5/hmx hmx Hmong-Mien languages hmong-mien, langues
|
|
51
|
+
http://id.loc.gov/vocabulary/iso639-5/hok hok Hokan languages hoka, langues
|
|
52
|
+
http://id.loc.gov/vocabulary/iso639-5/hyx hyx Armenian (family) arménien (famille)
|
|
53
|
+
http://id.loc.gov/vocabulary/iso639-5/iir iir Indo-Iranian languages indo-iraniennes, langues
|
|
54
|
+
http://id.loc.gov/vocabulary/iso639-5/ijo ijo Ijo languages ijo, langues
|
|
55
|
+
http://id.loc.gov/vocabulary/iso639-5/inc inc Indic languages indo-aryennes, langues
|
|
56
|
+
http://id.loc.gov/vocabulary/iso639-5/ine ine Indo-European languages indo-européennes, langues
|
|
57
|
+
http://id.loc.gov/vocabulary/iso639-5/ira ira Iranian languages iraniennes, langues
|
|
58
|
+
http://id.loc.gov/vocabulary/iso639-5/iro iro Iroquoian languages iroquoises, langues
|
|
59
|
+
http://id.loc.gov/vocabulary/iso639-5/itc itc Italic languages italiques, langues
|
|
60
|
+
http://id.loc.gov/vocabulary/iso639-5/jpx jpx Japanese (family) japonais (famille)
|
|
61
|
+
http://id.loc.gov/vocabulary/iso639-5/kar kar Karen languages karen, langues
|
|
62
|
+
http://id.loc.gov/vocabulary/iso639-5/kdo kdo Kordofanian languages kordofaniennes, langues
|
|
63
|
+
http://id.loc.gov/vocabulary/iso639-5/khi khi Khoisan languages khoïsan, langues
|
|
64
|
+
http://id.loc.gov/vocabulary/iso639-5/kro kro Kru languages krou, langues
|
|
65
|
+
http://id.loc.gov/vocabulary/iso639-5/map map Austronesian languages austronésiennes, langues
|
|
66
|
+
http://id.loc.gov/vocabulary/iso639-5/mkh mkh Mon-Khmer languages môn-khmer, langues
|
|
67
|
+
http://id.loc.gov/vocabulary/iso639-5/mno mno Manobo languages manobo, langues
|
|
68
|
+
http://id.loc.gov/vocabulary/iso639-5/mun mun Munda languages mounda, langues
|
|
69
|
+
http://id.loc.gov/vocabulary/iso639-5/myn myn Mayan languages maya, langues
|
|
70
|
+
http://id.loc.gov/vocabulary/iso639-5/nah nah Nahuatl languages nahuatl, langues
|
|
71
|
+
http://id.loc.gov/vocabulary/iso639-5/nai nai North American Indian languages nord-amérindiennes, langues
|
|
72
|
+
http://id.loc.gov/vocabulary/iso639-5/ngf ngf Trans-New Guinea languages trans-nouvelle-guinée, langues
|
|
73
|
+
http://id.loc.gov/vocabulary/iso639-5/nic nic Niger-Kordofanian languages nigéro-kordofaniennes, langues
|
|
74
|
+
http://id.loc.gov/vocabulary/iso639-5/nub nub Nubian languages nubiennes, langues
|
|
75
|
+
http://id.loc.gov/vocabulary/iso639-5/omq omq Oto-Manguean languages otomangue, langues
|
|
76
|
+
http://id.loc.gov/vocabulary/iso639-5/omv omv Omotic languages omotiques, langues
|
|
77
|
+
http://id.loc.gov/vocabulary/iso639-5/oto oto Otomian languages otomi, langues
|
|
78
|
+
http://id.loc.gov/vocabulary/iso639-5/paa paa Papuan languages papoues, langues
|
|
79
|
+
http://id.loc.gov/vocabulary/iso639-5/phi phi Philippine languages philippines, langues
|
|
80
|
+
http://id.loc.gov/vocabulary/iso639-5/plf plf Central Malayo-Polynesian languages malayo-polynésiennes centrales, langues
|
|
81
|
+
http://id.loc.gov/vocabulary/iso639-5/poz poz Malayo-Polynesian languages malayo-polynésiennes, langues
|
|
82
|
+
http://id.loc.gov/vocabulary/iso639-5/pqe pqe Eastern Malayo-Polynesian languages malayo-polynésiennes orientales, langues
|
|
83
|
+
http://id.loc.gov/vocabulary/iso639-5/pqw pqw Western Malayo-Polynesian languages malayo-polynésiennes occidentales, langues
|
|
84
|
+
http://id.loc.gov/vocabulary/iso639-5/pra pra Prakrit languages prâkrit, langues
|
|
85
|
+
http://id.loc.gov/vocabulary/iso639-5/qwe qwe Quechuan (family) quechua (famille)
|
|
86
|
+
http://id.loc.gov/vocabulary/iso639-5/roa roa Romance languages romanes, langues
|
|
87
|
+
http://id.loc.gov/vocabulary/iso639-5/sai sai South American Indian languages sud-amérindiennes, langues
|
|
88
|
+
http://id.loc.gov/vocabulary/iso639-5/sal sal Salishan languages salishennes, langues
|
|
89
|
+
http://id.loc.gov/vocabulary/iso639-5/sdv sdv Eastern Sudanic languages soudaniques orientales, langues
|
|
90
|
+
http://id.loc.gov/vocabulary/iso639-5/sem sem Semitic languages sémitiques, langues
|
|
91
|
+
http://id.loc.gov/vocabulary/iso639-5/sgn sgn sign languages langues des signes
|
|
92
|
+
http://id.loc.gov/vocabulary/iso639-5/sio sio Siouan languages sioux, langues
|
|
93
|
+
http://id.loc.gov/vocabulary/iso639-5/sit sit Sino-Tibetan languages sino-tibétaines, langues
|
|
94
|
+
http://id.loc.gov/vocabulary/iso639-5/sla sla Slavic languages slaves, langues
|
|
95
|
+
http://id.loc.gov/vocabulary/iso639-5/smi smi Sami languages sames, langues
|
|
96
|
+
http://id.loc.gov/vocabulary/iso639-5/son son Songhai languages songhai, langues
|
|
97
|
+
http://id.loc.gov/vocabulary/iso639-5/sqj sqj Albanian languages albanaises, langues
|
|
98
|
+
http://id.loc.gov/vocabulary/iso639-5/ssa ssa Nilo-Saharan languages nilo-sahariennes, langues
|
|
99
|
+
http://id.loc.gov/vocabulary/iso639-5/syd syd Samoyedic languages samoyèdes, langues
|
|
100
|
+
http://id.loc.gov/vocabulary/iso639-5/tai tai Tai languages tai, langues
|
|
101
|
+
http://id.loc.gov/vocabulary/iso639-5/tbq tbq Tibeto-Burman languages tibéto-birmanes, langues
|
|
102
|
+
http://id.loc.gov/vocabulary/iso639-5/trk trk Turkic languages turques, langues
|
|
103
|
+
http://id.loc.gov/vocabulary/iso639-5/tup tup Tupi languages tupi, langues
|
|
104
|
+
http://id.loc.gov/vocabulary/iso639-5/tut tut Altaic languages altaïques, langues
|
|
105
|
+
http://id.loc.gov/vocabulary/iso639-5/tuw tuw Tungus languages toungouses, langues
|
|
106
|
+
http://id.loc.gov/vocabulary/iso639-5/urj urj Uralic languages ouraliennes, langues
|
|
107
|
+
http://id.loc.gov/vocabulary/iso639-5/wak wak Wakashan languages wakashanes, langues
|
|
108
|
+
http://id.loc.gov/vocabulary/iso639-5/wen wen Sorbian languages sorabes, langues
|
|
109
|
+
http://id.loc.gov/vocabulary/iso639-5/xgn xgn Mongolian languages mongoles, langues
|
|
110
|
+
http://id.loc.gov/vocabulary/iso639-5/xnd xnd Na-Dene languages na-déné, langues
|
|
111
|
+
http://id.loc.gov/vocabulary/iso639-5/ypk ypk Yupik languages yupik, langues
|
|
112
|
+
http://id.loc.gov/vocabulary/iso639-5/zhx zhx Chinese (family) chinois (famille)
|
|
113
|
+
http://id.loc.gov/vocabulary/iso639-5/zle zle East Slavic languages slaves orientales, langues
|
|
114
|
+
http://id.loc.gov/vocabulary/iso639-5/zls zls South Slavic languages slaves méridionales, langues
|
|
115
|
+
http://id.loc.gov/vocabulary/iso639-5/zlw zlw West Slavic languages slaves occidentales, langues
|
|
116
|
+
http://id.loc.gov/vocabulary/iso639-5/znd znd Zande languages zandé, langues
|
data/lib/languages/constants.rb
CHANGED
data/lib/languages/language.rb
CHANGED
|
@@ -5,17 +5,16 @@ module Languages
|
|
|
5
5
|
class Language
|
|
6
6
|
include Comparable
|
|
7
7
|
|
|
8
|
-
attr_reader :iso639_1, :iso639_2b, :iso639_2t, :iso639_3, :scope, :type, :name, :macrolanguage
|
|
8
|
+
attr_reader :iso639_1, :iso639_2b, :iso639_2t, :iso639_3, :scope, :type, :name, :macrolanguage
|
|
9
9
|
|
|
10
|
-
def initialize(csv_attributes)
|
|
10
|
+
def initialize(csv_attributes)
|
|
11
11
|
@iso639_3 = csv_attributes.fetch(:id).to_sym
|
|
12
12
|
@iso639_2b = csv_attributes.fetch(:part2b)&.to_sym
|
|
13
13
|
@iso639_2t = csv_attributes.fetch(:part2t)&.to_sym
|
|
14
14
|
@iso639_1 = csv_attributes.fetch(:part1)&.to_sym
|
|
15
|
-
@scope =
|
|
16
|
-
@type =
|
|
15
|
+
@scope = parse_scope(csv_attributes.fetch(:scope))
|
|
16
|
+
@type = parse_type(csv_attributes.fetch(:language_type))
|
|
17
17
|
@name = csv_attributes.fetch(:ref_name)
|
|
18
|
-
# @comment = csv_attributes.fetch(:comment)
|
|
19
18
|
end
|
|
20
19
|
|
|
21
20
|
alias iso639_2 iso639_2t
|
|
@@ -32,7 +31,7 @@ module Languages
|
|
|
32
31
|
|
|
33
32
|
TYPES.each do |type|
|
|
34
33
|
define_method "#{type}?" do
|
|
35
|
-
self.type == type.to_sym
|
|
34
|
+
self.type == type.to_sym # steep:ignore NoMethod
|
|
36
35
|
end
|
|
37
36
|
end
|
|
38
37
|
|
|
@@ -41,7 +40,7 @@ module Languages
|
|
|
41
40
|
method_name = scope.end_with?('language') ? scope : "#{scope}_language"
|
|
42
41
|
|
|
43
42
|
define_method "#{method_name}?" do
|
|
44
|
-
self.scope == scope.to_sym
|
|
43
|
+
self.scope == scope.to_sym # steep:ignore NoMethod
|
|
45
44
|
end
|
|
46
45
|
end
|
|
47
46
|
|
|
@@ -56,7 +55,21 @@ module Languages
|
|
|
56
55
|
end
|
|
57
56
|
|
|
58
57
|
def <=>(other)
|
|
59
|
-
|
|
58
|
+
iso639_3 <=> other.iso639_3
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
private
|
|
62
|
+
|
|
63
|
+
# @param [String, nil] code Single uppercase character representing the scope in ISO 639 data
|
|
64
|
+
# @return [Symbol, nil]
|
|
65
|
+
def parse_scope(code)
|
|
66
|
+
SCOPES.detect { |s| s.chr.upcase == code }&.to_sym
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# @param [String, nil] code Single uppercase character representing the language type in ISO 639 data
|
|
70
|
+
# @return [Symbol, nil]
|
|
71
|
+
def parse_type(code)
|
|
72
|
+
TYPES.detect { |t| t.chr.upcase == code }&.to_sym
|
|
60
73
|
end
|
|
61
74
|
end
|
|
62
75
|
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Languages
|
|
4
|
+
# Language family or group defined in ISO 639-5
|
|
5
|
+
class LanguageFamily
|
|
6
|
+
include Comparable
|
|
7
|
+
|
|
8
|
+
attr_reader :iso639_5, :name, :name_fr
|
|
9
|
+
|
|
10
|
+
alias alpha3 iso639_5
|
|
11
|
+
|
|
12
|
+
def initialize(csv_attributes)
|
|
13
|
+
@iso639_5 = csv_attributes.fetch(:code).to_sym
|
|
14
|
+
@name = csv_attributes.fetch(:name)
|
|
15
|
+
@name_fr = csv_attributes.fetch(:name_fr)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def to_s
|
|
19
|
+
name.to_s
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def ==(other)
|
|
23
|
+
other.class == self.class && other.iso639_5 == iso639_5
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
alias eql? ==
|
|
27
|
+
|
|
28
|
+
def hash
|
|
29
|
+
iso639_5.hash
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def <=>(other)
|
|
33
|
+
iso639_5 <=> other.iso639_5
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
data/lib/languages/version.rb
CHANGED
data/lib/languages.rb
CHANGED
|
@@ -5,26 +5,23 @@ require 'csv'
|
|
|
5
5
|
require_relative 'languages/version'
|
|
6
6
|
require_relative 'languages/constants'
|
|
7
7
|
require_relative 'languages/language'
|
|
8
|
+
require_relative 'languages/language_family'
|
|
8
9
|
|
|
9
10
|
# Provides living, extinct, ancient, historic, and constructed languages, specified in ISO 639-3
|
|
10
11
|
module Languages
|
|
11
12
|
class << self
|
|
12
13
|
TYPES.each do |type|
|
|
13
14
|
define_method type do
|
|
14
|
-
all.select { |l| l.public_send("#{type}?") }
|
|
15
|
+
all.select { |l| l.public_send("#{type}?") } # steep:ignore NoMethod
|
|
15
16
|
end
|
|
16
17
|
end
|
|
17
18
|
|
|
18
|
-
extend Gem::Deprecate
|
|
19
|
-
|
|
20
|
-
deprecate :ancient, :none, 2025, 3
|
|
21
|
-
|
|
22
19
|
SCOPES.each do |scope|
|
|
23
20
|
# prevent ambiguity of scope "special" and type "special"
|
|
24
21
|
scope = "#{scope}_language" unless scope.end_with? 'language'
|
|
25
22
|
|
|
26
23
|
define_method "#{scope}s" do
|
|
27
|
-
all.select { |l| l.public_send("#{scope}?") }
|
|
24
|
+
all.select { |l| l.public_send("#{scope}?") } # steep:ignore NoMethod
|
|
28
25
|
end
|
|
29
26
|
end
|
|
30
27
|
|
|
@@ -45,7 +42,7 @@ module Languages
|
|
|
45
42
|
|
|
46
43
|
# Returns all human known languages, specified in ISO 639-3
|
|
47
44
|
def all
|
|
48
|
-
data.values
|
|
45
|
+
@data.values
|
|
49
46
|
end
|
|
50
47
|
|
|
51
48
|
def names
|
|
@@ -60,6 +57,11 @@ module Languages
|
|
|
60
57
|
all.map(&:alpha3)
|
|
61
58
|
end
|
|
62
59
|
|
|
60
|
+
# Returns all language families and groups defined in ISO 639-5
|
|
61
|
+
def language_families
|
|
62
|
+
@language_families.values
|
|
63
|
+
end
|
|
64
|
+
|
|
63
65
|
private
|
|
64
66
|
|
|
65
67
|
# Returns language associated with ISO 639-1 identifier
|
|
@@ -69,11 +71,11 @@ module Languages
|
|
|
69
71
|
all.detect { |l| l.iso639_1 == key }
|
|
70
72
|
end
|
|
71
73
|
|
|
72
|
-
# Returns language associated with ISO 639-2 or
|
|
73
|
-
# @param [Symbol] key ISO 639-2 or ISO 639-
|
|
74
|
-
# @return [Language,NilClass]
|
|
74
|
+
# Returns language or language family associated with an ISO 639-2, 639-3, or 639-5 identifier
|
|
75
|
+
# @param [Symbol] key ISO 639-2, ISO 639-3, or ISO 639-5 identifier
|
|
76
|
+
# @return [Language,LanguageFamily,NilClass] object associated with the identifier; otherwise +nil+
|
|
75
77
|
def get_by_alpha3(key)
|
|
76
|
-
data[key] || all.detect { |l| l.iso639_2b == key || l.iso639_2t == key }
|
|
78
|
+
@data[key] || all.detect { |l| l.iso639_2b == key || l.iso639_2t == key } || @language_families[key]
|
|
77
79
|
end
|
|
78
80
|
|
|
79
81
|
# Returns language associated with ISO 639-3 reference name
|
|
@@ -83,23 +85,25 @@ module Languages
|
|
|
83
85
|
all.detect { |l| l.name.downcase == name.downcase }
|
|
84
86
|
end
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def data
|
|
89
|
-
@@data
|
|
88
|
+
def load_tsv_data(filename)
|
|
89
|
+
CSV.read(File.join(__dir__.to_s, '..', 'data', filename), headers: true, col_sep: "\t")
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
def
|
|
93
|
-
|
|
92
|
+
def load_language_families
|
|
93
|
+
load_tsv_data('iso-639-5.tsv')
|
|
94
|
+
.map { |row| { code: row['code'], name: row['Label (English)'], name_fr: row['Label (French)'] } }
|
|
95
|
+
.to_h { |attrs| [attrs[:code].to_sym, LanguageFamily.new(attrs)] }
|
|
96
|
+
.freeze
|
|
94
97
|
end
|
|
95
98
|
end
|
|
96
99
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
@language_families = load_language_families
|
|
101
|
+
|
|
102
|
+
@data = load_tsv_data('iso-639-3.tsv')
|
|
103
|
+
.map { |row| row.to_h.transform_keys { |k| k.downcase.to_sym } }
|
|
104
|
+
.to_h { |l| [l[:id].to_sym, Language.new(l)] }
|
|
105
|
+
.freeze
|
|
101
106
|
|
|
102
107
|
load_tsv_data('iso-639-3-macrolanguages.tsv')
|
|
103
|
-
|
|
104
|
-
.each { |row| data[row[1].to_sym].instance_variable_set(:@macrolanguage, data[row[0].to_sym]) if row[2] == 'A' }
|
|
108
|
+
.each { |row| @data[row[1].to_sym].instance_variable_set(:@macrolanguage, @data[row[0].to_sym]) if row[2] == 'A' }
|
|
105
109
|
end
|
data/sig/languages.rbs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
module Languages
|
|
2
2
|
VERSION: String
|
|
3
|
-
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
|
|
4
3
|
|
|
5
4
|
TYPES: Array[String]
|
|
6
5
|
SCOPES: Array[String]
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
@data: Hash[Symbol, Language]
|
|
9
8
|
|
|
10
|
-
def self?.[]: (String | Symbol) -> Language?
|
|
9
|
+
def self?.[]: (String | Symbol) -> (Language | LanguageFamily)?
|
|
11
10
|
def self?.search: (Regexp pattern) -> Array[Language]
|
|
12
11
|
|
|
13
12
|
def self?.all: () -> Array[Language]
|
|
@@ -16,23 +15,50 @@ module Languages
|
|
|
16
15
|
def self?.alpha3_codes: () -> Array[Symbol]
|
|
17
16
|
|
|
18
17
|
def self?.special_languages: () -> Array[Language]
|
|
19
|
-
def self?.macrolanguages:() -> Array[Language]
|
|
18
|
+
def self?.macrolanguages: () -> Array[Language]
|
|
20
19
|
def self?.individual_languages: () -> Array[Language]
|
|
21
20
|
|
|
22
|
-
def self?.ancient: () -> Array[Language]
|
|
23
21
|
def self?.constructed: () -> Array[Language]
|
|
24
22
|
def self?.extinct: () -> Array[Language]
|
|
25
23
|
def self?.historical: () -> Array[Language]
|
|
26
24
|
def self?.living: () -> Array[Language]
|
|
27
25
|
def self?.special: () -> Array[Language]
|
|
28
26
|
|
|
27
|
+
def self?.language_families: () -> Array[LanguageFamily]
|
|
28
|
+
|
|
29
|
+
def self?.load_language_families: () -> Hash[Symbol, LanguageFamily]
|
|
30
|
+
|
|
31
|
+
def self?.get_by_alpha2: (Symbol key) -> Language?
|
|
32
|
+
def self?.get_by_alpha3: (Symbol key) -> (Language | LanguageFamily)?
|
|
33
|
+
def self?.get_by_name: (String name) -> Language?
|
|
34
|
+
def self?.load_tsv_data: (String filename) -> untyped
|
|
35
|
+
|
|
36
|
+
class LanguageFamily
|
|
37
|
+
include Comparable
|
|
38
|
+
|
|
39
|
+
attr_reader iso639_5: Symbol
|
|
40
|
+
attr_reader name: String
|
|
41
|
+
attr_reader name_fr: String
|
|
42
|
+
|
|
43
|
+
alias alpha3 iso639_5
|
|
44
|
+
|
|
45
|
+
def initialize: ({code: String, name: String, name_fr: String}) -> void
|
|
46
|
+
|
|
47
|
+
def to_s: () -> String
|
|
48
|
+
|
|
49
|
+
def ==: (untyped) -> bool
|
|
50
|
+
alias eql? ==
|
|
51
|
+
def hash: () -> Integer
|
|
52
|
+
def <=>: (LanguageFamily) -> Integer?
|
|
53
|
+
end
|
|
54
|
+
|
|
29
55
|
class Language
|
|
30
56
|
attr_reader iso639_1: Symbol?
|
|
31
57
|
attr_reader iso639_2b: Symbol?
|
|
32
58
|
attr_reader iso639_2t: Symbol?
|
|
33
59
|
attr_reader iso639_3: Symbol
|
|
34
|
-
attr_reader scope:
|
|
35
|
-
attr_reader type:
|
|
60
|
+
attr_reader scope: Symbol?
|
|
61
|
+
attr_reader type: Symbol?
|
|
36
62
|
attr_reader name: String
|
|
37
63
|
attr_reader macrolanguage: Language?
|
|
38
64
|
|
|
@@ -44,13 +70,12 @@ module Languages
|
|
|
44
70
|
alias alpha3_bibliographic iso639_2b
|
|
45
71
|
alias alpha3_terminology iso639_2t
|
|
46
72
|
|
|
47
|
-
|
|
48
|
-
def initialize: ({id: String, part2b: String?, part2t: String?, part1: String?, scope: "I" | "M" | "S", language_type: "A" | "C" | "E" | "H" | "L" | "S", ref_name: String, comment: String?}) -> void
|
|
73
|
+
def initialize: ({id: String, part2b: String?, part2t: String?, part1: String?, scope: "I" | "M" | "S", language_type: "A" | "C" | "E" | "H" | "L" | "S", ref_name: String}) -> void
|
|
49
74
|
|
|
50
75
|
def to_s: () -> String
|
|
51
76
|
|
|
52
77
|
def special_language?: () -> bool
|
|
53
|
-
def macrolanguage
|
|
78
|
+
def macrolanguage?: () -> bool
|
|
54
79
|
def individual_language?: () -> bool
|
|
55
80
|
|
|
56
81
|
def ancient?: () -> bool
|
|
@@ -63,6 +88,9 @@ module Languages
|
|
|
63
88
|
def ==: (untyped) -> bool
|
|
64
89
|
alias eql? ==
|
|
65
90
|
def hash: () -> Integer
|
|
66
|
-
def <=>: (Language) -> Integer
|
|
91
|
+
def <=>: (Language) -> Integer?
|
|
92
|
+
|
|
93
|
+
def parse_scope: (String? code) -> Symbol?
|
|
94
|
+
def parse_type: (String? code) -> Symbol?
|
|
67
95
|
end
|
|
68
96
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: human_languages
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Benno Bielmeier
|
|
@@ -32,6 +32,7 @@ extensions: []
|
|
|
32
32
|
extra_rdoc_files: []
|
|
33
33
|
files:
|
|
34
34
|
- CHANGELOG.md
|
|
35
|
+
- CONTRIBUTING.adoc
|
|
35
36
|
- Gemfile
|
|
36
37
|
- Gemfile.lock
|
|
37
38
|
- LICENSE
|
|
@@ -40,12 +41,14 @@ files:
|
|
|
40
41
|
- README.adoc
|
|
41
42
|
- REUSE.toml
|
|
42
43
|
- Rakefile
|
|
44
|
+
- Steepfile
|
|
43
45
|
- data/iso-639-3-macrolanguages.tsv
|
|
44
46
|
- data/iso-639-3.tsv
|
|
45
|
-
-
|
|
47
|
+
- data/iso-639-5.tsv
|
|
46
48
|
- lib/languages.rb
|
|
47
49
|
- lib/languages/constants.rb
|
|
48
50
|
- lib/languages/language.rb
|
|
51
|
+
- lib/languages/language_family.rb
|
|
49
52
|
- lib/languages/version.rb
|
|
50
53
|
- sig/languages.rbs
|
|
51
54
|
homepage: https://github.com/bbenno/languages
|
|
@@ -55,6 +58,8 @@ metadata:
|
|
|
55
58
|
homepage_uri: https://github.com/bbenno/languages
|
|
56
59
|
source_code_uri: https://github.com/bbenno/languages
|
|
57
60
|
changelog_uri: https://github.com/bbenno/languages/blob/HEAD/CHANGELOG.md
|
|
61
|
+
bugs_uri: https://github.com/bbenno/languages/issues
|
|
62
|
+
documentation_uri: https://bbenno.github.io/languages
|
|
58
63
|
rubygems_mfa_required: 'true'
|
|
59
64
|
github_repo: git@github.com:bbenno/languages.git
|
|
60
65
|
rdoc_options: []
|
|
@@ -71,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
71
76
|
- !ruby/object:Gem::Version
|
|
72
77
|
version: '0'
|
|
73
78
|
requirements: []
|
|
74
|
-
rubygems_version: 3.
|
|
79
|
+
rubygems_version: 3.7.2
|
|
75
80
|
specification_version: 4
|
|
76
|
-
summary: ISO 639-3
|
|
81
|
+
summary: All known human languages from ISO 639-3, with no runtime dependencies
|
|
77
82
|
test_files: []
|
data/human_languages.gemspec
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'lib/languages/version'
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = 'human_languages'
|
|
7
|
-
spec.version = Languages::VERSION
|
|
8
|
-
spec.authors = ['Benno Bielmeier']
|
|
9
|
-
spec.email = ['git@bbenno.com']
|
|
10
|
-
|
|
11
|
-
spec.summary = 'ISO 639-3 languages'
|
|
12
|
-
spec.description = 'ISO 639-3 is a set of codes that defines three-letter identifiers for all known human languages.'
|
|
13
|
-
spec.homepage = 'https://github.com/bbenno/languages'
|
|
14
|
-
spec.license = 'MIT'
|
|
15
|
-
spec.required_ruby_version = '>= 3.2.0'
|
|
16
|
-
|
|
17
|
-
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
|
18
|
-
|
|
19
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
|
20
|
-
spec.metadata['source_code_uri'] = spec.homepage
|
|
21
|
-
spec.metadata['changelog_uri'] = "#{spec.metadata['source_code_uri']}/blob/HEAD/CHANGELOG.md"
|
|
22
|
-
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
23
|
-
spec.metadata['github_repo'] = 'git@github.com:bbenno/languages.git'
|
|
24
|
-
|
|
25
|
-
# Specify which files should be added to the gem when it is released.
|
|
26
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
27
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
28
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
|
29
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test)/|\.(?:git|rubocop|envrc)|devenv)})
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
spec.bindir = 'exe'
|
|
33
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
34
|
-
spec.require_paths = ['lib']
|
|
35
|
-
|
|
36
|
-
# Uncomment to register a new dependency of your gem
|
|
37
|
-
# spec.add_dependency "example-gem", "~> 1.0"
|
|
38
|
-
spec.add_dependency('csv', '~> 3.0')
|
|
39
|
-
|
|
40
|
-
# For more information and examples about making a new gem, check out our
|
|
41
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
|
42
|
-
end
|