i18n_data 0.12.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/cache/file_data_provider/countries-AB.txt +47 -47
  3. data/cache/file_data_provider/countries-AF.txt +4 -4
  4. data/cache/file_data_provider/countries-AK.txt +8 -8
  5. data/cache/file_data_provider/countries-AM.txt +25 -25
  6. data/cache/file_data_provider/countries-AN.txt +107 -107
  7. data/cache/file_data_provider/countries-AS.txt +4 -4
  8. data/cache/file_data_provider/countries-AY.txt +2 -2
  9. data/cache/file_data_provider/countries-AZ.txt +30 -30
  10. data/cache/file_data_provider/countries-BA.txt +186 -186
  11. data/cache/file_data_provider/countries-BG.txt +2 -2
  12. data/cache/file_data_provider/countries-BI.txt +14 -14
  13. data/cache/file_data_provider/countries-BR.txt +4 -4
  14. data/cache/file_data_provider/countries-BS.txt +3 -3
  15. data/cache/file_data_provider/countries-CA.txt +2 -2
  16. data/cache/file_data_provider/countries-CE.txt +3 -3
  17. data/cache/file_data_provider/countries-CH.txt +2 -2
  18. data/cache/file_data_provider/countries-CV.txt +3 -3
  19. data/cache/file_data_provider/countries-DE.txt +2 -2
  20. data/cache/file_data_provider/countries-DV.txt +3 -3
  21. data/cache/file_data_provider/countries-DZ.txt +5 -5
  22. data/cache/file_data_provider/countries-EE.txt +12 -12
  23. data/cache/file_data_provider/countries-EN.txt +2 -2
  24. data/cache/file_data_provider/countries-EO.txt +5 -5
  25. data/cache/file_data_provider/countries-ES.txt +2 -2
  26. data/cache/file_data_provider/countries-ET.txt +3 -3
  27. data/cache/file_data_provider/countries-FF.txt +2 -2
  28. data/cache/file_data_provider/countries-FI.txt +3 -3
  29. data/cache/file_data_provider/countries-FO.txt +9 -9
  30. data/cache/file_data_provider/countries-FR.txt +3 -3
  31. data/cache/file_data_provider/countries-FY.txt +3 -3
  32. data/cache/file_data_provider/countries-GA.txt +2 -2
  33. data/cache/file_data_provider/countries-GL.txt +2 -2
  34. data/cache/file_data_provider/countries-GN.txt +5 -5
  35. data/cache/file_data_provider/countries-GU.txt +6 -6
  36. data/cache/file_data_provider/countries-GV.txt +2 -2
  37. data/cache/file_data_provider/countries-HA.txt +2 -2
  38. data/cache/file_data_provider/countries-HE.txt +59 -59
  39. data/cache/file_data_provider/countries-HI.txt +113 -113
  40. data/cache/file_data_provider/countries-HR.txt +2 -2
  41. data/cache/file_data_provider/countries-HT.txt +3 -3
  42. data/cache/file_data_provider/countries-HY.txt +2 -2
  43. data/cache/file_data_provider/countries-IO.txt +3 -3
  44. data/cache/file_data_provider/countries-IS.txt +2 -2
  45. data/cache/file_data_provider/countries-IU.txt +2 -2
  46. data/cache/file_data_provider/countries-JA.txt +1 -1
  47. data/cache/file_data_provider/countries-KA.txt +5 -5
  48. data/cache/file_data_provider/countries-KI.txt +2 -2
  49. data/cache/file_data_provider/countries-KK.txt +2 -2
  50. data/cache/file_data_provider/countries-KL.txt +37 -37
  51. data/cache/file_data_provider/countries-KM.txt +1 -1
  52. data/cache/file_data_provider/countries-KN.txt +5 -5
  53. data/cache/file_data_provider/countries-KV.txt +2 -2
  54. data/cache/file_data_provider/countries-KW.txt +3 -3
  55. data/cache/file_data_provider/countries-KY.txt +1 -1
  56. data/cache/file_data_provider/countries-LO.txt +2 -2
  57. data/cache/file_data_provider/countries-LT.txt +3 -3
  58. data/cache/file_data_provider/countries-LV.txt +2 -2
  59. data/cache/file_data_provider/countries-MI.txt +17 -17
  60. data/cache/file_data_provider/countries-MK.txt +3 -3
  61. data/cache/file_data_provider/countries-ML.txt +6 -6
  62. data/cache/file_data_provider/countries-MN.txt +11 -11
  63. data/cache/file_data_provider/countries-MS.txt +6 -6
  64. data/cache/file_data_provider/countries-MT.txt +21 -21
  65. data/cache/file_data_provider/countries-MY.txt +2 -2
  66. data/cache/file_data_provider/countries-NA.txt +2 -2
  67. data/cache/file_data_provider/countries-NB.txt +4 -4
  68. data/cache/file_data_provider/countries-NE.txt +3 -3
  69. data/cache/file_data_provider/countries-NL.txt +1 -1
  70. data/cache/file_data_provider/countries-NN.txt +3 -3
  71. data/cache/file_data_provider/countries-NV.txt +2 -2
  72. data/cache/file_data_provider/countries-OC.txt +61 -61
  73. data/cache/file_data_provider/countries-PI.txt +2 -2
  74. data/cache/file_data_provider/countries-PS.txt +4 -4
  75. data/cache/file_data_provider/countries-PT_BR.txt +2 -2
  76. data/cache/file_data_provider/countries-RO.txt +1 -1
  77. data/cache/file_data_provider/countries-RU.txt +3 -3
  78. data/cache/file_data_provider/countries-RW.txt +4 -4
  79. data/cache/file_data_provider/countries-SC.txt +2 -2
  80. data/cache/file_data_provider/countries-SD.txt +2 -2
  81. data/cache/file_data_provider/countries-SI.txt +2 -2
  82. data/cache/file_data_provider/countries-SK.txt +1 -1
  83. data/cache/file_data_provider/countries-SL.txt +2 -2
  84. data/cache/file_data_provider/countries-SO.txt +7 -7
  85. data/cache/file_data_provider/countries-SR.txt +7 -7
  86. data/cache/file_data_provider/countries-SV.txt +1 -1
  87. data/cache/file_data_provider/countries-SW.txt +10 -10
  88. data/cache/file_data_provider/countries-TA.txt +5 -5
  89. data/cache/file_data_provider/countries-TE.txt +3 -3
  90. data/cache/file_data_provider/countries-TH.txt +1 -1
  91. data/cache/file_data_provider/countries-TI.txt +58 -58
  92. data/cache/file_data_provider/countries-TK.txt +6 -6
  93. data/cache/file_data_provider/countries-TL.txt +2 -2
  94. data/cache/file_data_provider/countries-TR.txt +2 -2
  95. data/cache/file_data_provider/countries-TT.txt +7 -7
  96. data/cache/file_data_provider/countries-UR.txt +3 -3
  97. data/cache/file_data_provider/countries-UZ.txt +3 -3
  98. data/cache/file_data_provider/countries-VE.txt +25 -25
  99. data/cache/file_data_provider/countries-VI.txt +2 -2
  100. data/cache/file_data_provider/countries-WA.txt +2 -2
  101. data/cache/file_data_provider/countries-WO.txt +4 -4
  102. data/cache/file_data_provider/countries-XH.txt +60 -60
  103. data/cache/file_data_provider/countries-YO.txt +3 -3
  104. data/cache/file_data_provider/countries-ZH_CN.txt +5 -5
  105. data/cache/file_data_provider/countries-ZU.txt +42 -42
  106. data/cache/file_data_provider/languages-AF.txt +28 -28
  107. data/cache/file_data_provider/languages-AM.txt +10 -10
  108. data/cache/file_data_provider/languages-AR.txt +33 -33
  109. data/cache/file_data_provider/languages-AS.txt +4 -4
  110. data/cache/file_data_provider/languages-AZ.txt +60 -60
  111. data/cache/file_data_provider/languages-BE.txt +2 -2
  112. data/cache/file_data_provider/languages-BG.txt +3 -3
  113. data/cache/file_data_provider/languages-BN.txt +1 -1
  114. data/cache/file_data_provider/languages-BR.txt +2 -2
  115. data/cache/file_data_provider/languages-BS.txt +27 -27
  116. data/cache/file_data_provider/languages-CA.txt +1 -1
  117. data/cache/file_data_provider/languages-CS.txt +2 -2
  118. data/cache/file_data_provider/languages-CY.txt +42 -42
  119. data/cache/file_data_provider/languages-DA.txt +2 -2
  120. data/cache/file_data_provider/languages-DE.txt +1 -1
  121. data/cache/file_data_provider/languages-EL.txt +7 -7
  122. data/cache/file_data_provider/languages-EO.txt +3 -3
  123. data/cache/file_data_provider/languages-ES.txt +1 -1
  124. data/cache/file_data_provider/languages-ET.txt +2 -2
  125. data/cache/file_data_provider/languages-FA.txt +21 -21
  126. data/cache/file_data_provider/languages-FI.txt +4 -4
  127. data/cache/file_data_provider/languages-FR.txt +2 -2
  128. data/cache/file_data_provider/languages-GA.txt +4 -4
  129. data/cache/file_data_provider/languages-GL.txt +4 -4
  130. data/cache/file_data_provider/languages-GU.txt +4 -4
  131. data/cache/file_data_provider/languages-HE.txt +30 -30
  132. data/cache/file_data_provider/languages-HI.txt +10 -10
  133. data/cache/file_data_provider/languages-HR.txt +3 -3
  134. data/cache/file_data_provider/languages-HU.txt +2 -2
  135. data/cache/file_data_provider/languages-ID.txt +2 -2
  136. data/cache/file_data_provider/languages-IS.txt +2 -2
  137. data/cache/file_data_provider/languages-IT.txt +3 -3
  138. data/cache/file_data_provider/languages-JA.txt +8 -8
  139. data/cache/file_data_provider/languages-KN.txt +5 -5
  140. data/cache/file_data_provider/languages-KO.txt +2 -2
  141. data/cache/file_data_provider/languages-LT.txt +6 -6
  142. data/cache/file_data_provider/languages-LV.txt +4 -4
  143. data/cache/file_data_provider/languages-MI.txt +62 -62
  144. data/cache/file_data_provider/languages-MK.txt +50 -50
  145. data/cache/file_data_provider/languages-ML.txt +5 -5
  146. data/cache/file_data_provider/languages-MN.txt +29 -29
  147. data/cache/file_data_provider/languages-MR.txt +2 -2
  148. data/cache/file_data_provider/languages-MS.txt +42 -42
  149. data/cache/file_data_provider/languages-MT.txt +55 -55
  150. data/cache/file_data_provider/languages-NB.txt +32 -32
  151. data/cache/file_data_provider/languages-NL.txt +2 -2
  152. data/cache/file_data_provider/languages-NN.txt +13 -13
  153. data/cache/file_data_provider/languages-OC.txt +3 -3
  154. data/cache/file_data_provider/languages-OR.txt +2 -2
  155. data/cache/file_data_provider/languages-PA.txt +2 -2
  156. data/cache/file_data_provider/languages-PL.txt +1 -1
  157. data/cache/file_data_provider/languages-PS.txt +1 -1
  158. data/cache/file_data_provider/languages-PT.txt +40 -40
  159. data/cache/file_data_provider/languages-PT_BR.txt +2 -2
  160. data/cache/file_data_provider/languages-RO.txt +4 -4
  161. data/cache/file_data_provider/languages-RU.txt +4 -4
  162. data/cache/file_data_provider/languages-RW.txt +25 -25
  163. data/cache/file_data_provider/languages-SC.txt +2 -2
  164. data/cache/file_data_provider/languages-SK.txt +1 -1
  165. data/cache/file_data_provider/languages-SL.txt +3 -3
  166. data/cache/file_data_provider/languages-SR.txt +2 -2
  167. data/cache/file_data_provider/languages-SV.txt +1 -1
  168. data/cache/file_data_provider/languages-TA.txt +5 -5
  169. data/cache/file_data_provider/languages-TE.txt +5 -5
  170. data/cache/file_data_provider/languages-TG.txt +2 -2
  171. data/cache/file_data_provider/languages-TH.txt +3 -3
  172. data/cache/file_data_provider/languages-TI.txt +9 -9
  173. data/cache/file_data_provider/languages-TR.txt +1 -1
  174. data/cache/file_data_provider/languages-TT.txt +17 -17
  175. data/cache/file_data_provider/languages-UK.txt +2 -2
  176. data/cache/file_data_provider/languages-VE.txt +30 -30
  177. data/cache/file_data_provider/languages-VI.txt +4 -4
  178. data/cache/file_data_provider/languages-WA.txt +3 -3
  179. data/cache/file_data_provider/languages-XH.txt +41 -41
  180. data/cache/file_data_provider/languages-ZH_CN.txt +2 -2
  181. data/cache/file_data_provider/languages-ZH_HK.txt +2 -2
  182. data/cache/file_data_provider/languages-ZH_TW.txt +1 -1
  183. data/cache/file_data_provider/languages-ZU.txt +42 -42
  184. data/lib/i18n_data/live_data_provider.rb +50 -19
  185. data/lib/i18n_data/version.rb +1 -1
  186. data/lib/i18n_data.rb +1 -1
  187. metadata +18 -5
  188. data/cache/file_data_provider/countries-KU.txt +0 -249
@@ -1,70 +1,70 @@
1
1
  AA;;Afar
2
- AB;;Isi-Azerbaijani
2
+ AB;;Abkhazian
3
3
  AF;;Isibhunu
4
- AK;;Isi-Azerbaijani
5
- AM;;isi-Arabhu
4
+ AK;;Akan
5
+ AM;;Amharic
6
6
  AR;;isi-Arabhu
7
7
  AN;;Aragonese
8
8
  AS;;Assamese
9
- AV;;isi-Arabhu
9
+ AV;;Avaric
10
10
  AE;;Avestan
11
11
  AY;;Aymara
12
12
  AZ;;Isi-Azerbaijani
13
13
  BA;;Bashkir
14
14
  BM;;Bambara
15
- BE;;Isi-Buligariyana
15
+ BE;;Belarusian
16
16
  BN;;Bengali
17
- BH;;Isi-Koreyani
17
+ BH;;Bihari languages
18
18
  BI;;Bislama
19
19
  BO;;Tibetan
20
- BS;;Isi-Romayinani
20
+ BS;;Bosnian
21
21
  BR;;Isi-Bretoni
22
22
  BG;;Isi-Buligariyana
23
23
  CA;;Catalan; Valencian
24
24
  CS;;Isi Czechiya
25
25
  CH;;Chamorro
26
- CE;;Isi Czechiya
26
+ CE;;Chechen
27
27
  CU;;Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic
28
28
  CV;;Chuvash
29
- KW;;Isi-Irishi
30
- CO;;Isi-Bosniyani
31
- CR;;isi-Grike
29
+ KW;;Cornish
30
+ CO;;Corsican
31
+ CR;;Cree
32
32
  CY;;Isi Welsh
33
33
  DA;;Isi-Danishi
34
34
  DE;;isi-Jalimani
35
35
  DV;;Divehi; Dhivehi; Maldivian
36
36
  DZ;;Dzongkha
37
37
  EL;;Greek, Modern (1453-)
38
- EN;;Isi-Ngisi (UK)
38
+ EN;;English
39
39
  EO;;Isi-Esperanto
40
40
  ET;;Isi-Estoniyani
41
41
  EU;;Isi-Basque
42
42
  EE;;Ewe
43
43
  FO;;Faroese
44
- FA;;Isi-Sebhiyani
44
+ FA;;Persian
45
45
  FJ;;Fijian
46
46
  FI;;Isi-Finishi
47
47
  FR;;Isi-Frentshi
48
- FY;;Isi-Ukraniyani
48
+ FY;;Western Frisian
49
49
  FF;;Fulah
50
50
  GD;;Gaelic; Scottish Gaelic
51
51
  GA;;Isi-Irishi
52
- GL;;Isi-Galashiyani
52
+ GL;;Galician
53
53
  GV;;Manx
54
- GN;;Isi-Buligariyana
54
+ GN;;Guarani
55
55
  GU;;Gujarati
56
56
  HT;;Haitian; Haitian Creole
57
57
  HA;;Hausa
58
58
  HE;;Isi-Hebheru
59
- HZ;;Isi-Hebheru
59
+ HZ;;Herero
60
60
  HI;;Hindi
61
- HO;;Isi-Thekishi
61
+ HO;;Hiri Motu
62
62
  HR;;Isi-Croshiyani
63
63
  HU;;Isi-Hangariyani
64
- HY;;Isi-Romayinani
64
+ HY;;Armenian
65
65
  IG;;Igbo
66
66
  IO;;Ido
67
- II;;Isi-Lithuwaniya
67
+ II;;Sichuan Yi; Nuosu
68
68
  IU;;Inuktitut
69
69
  IE;;Interlingue; Occidental
70
70
  IA;;Interlingua (International Auxiliary Language Association)
@@ -72,13 +72,13 @@ ID;;Indoneshiya
72
72
  IK;;Inupiaq
73
73
  IS;;isi-Icilendikhi
74
74
  IT;;Isi-Taliyane
75
- JV;;Isi-Jaliphani
75
+ JV;;Javanese
76
76
  JA;;Isi-Jaliphani
77
77
  KL;;Kalaallisut; Greenlandic
78
78
  KN;;Kannada
79
79
  KS;;Kashmiri
80
- KA;;isi-Jalimani
81
- KR;;isi-Kedishi
80
+ KA;;Georgian
81
+ KR;;Kanuri
82
82
  KK;;Kazakh
83
83
  KM;;Central Khmer
84
84
  KI;;Kikuyu; Gikuyu
@@ -90,7 +90,7 @@ KO;;Isi-Koreyani
90
90
  KJ;;Kuanyama; Kwanyama
91
91
  KU;;isi-Kedishi
92
92
  LO;;Lao
93
- LA;;Isi-Lavithiyani
93
+ LA;;Latin
94
94
  LV;;Isi-Lavithiyani
95
95
  LI;;Limburgan; Limburger; Limburgish
96
96
  LN;;Lingala
@@ -98,13 +98,13 @@ LT;;Isi-Lithuwaniya
98
98
  LB;;Luxembourgish; Letzeburgesch
99
99
  LU;;Luba-Katanga
100
100
  LG;;Ganda
101
- MH;;Isi-Malithalise
101
+ MH;;Marshallese
102
102
  ML;;Malayalam
103
- MR;;Isi-Mawori
103
+ MR;;Marathi
104
104
  MK;;Isi-Makhedoniya
105
105
  MG;;Malagasy
106
106
  MT;;Isi-Malithalise
107
- MN;;Isi-Makhedoniya
107
+ MN;;Mongolian
108
108
  MI;;Isi-Mawori
109
109
  MS;;Malay
110
110
  MY;;Burmese
@@ -112,55 +112,55 @@ NA;;Nauru
112
112
  NV;;Navajo; Navaho
113
113
  NR;;Ndebele, South; South Ndebele
114
114
  ND;;Ndebele, North; North Ndebele
115
- NG;;Isi-Bosniyani
115
+ NG;;Ndonga
116
116
  NE;;Nepali
117
117
  NL;;Dutch; Flemish
118
- NN;;Isi-Nowejiyani (Nynorsk)
118
+ NN;;Norwegian Nynorsk; Nynorsk, Norwegian
119
119
  NB;;Bokmål, Norwegian; Norwegian Bokmål
120
- NO;;Isi-Koreyani
120
+ NO;;Norwegian
121
121
  NY;;Chichewa; Chewa; Nyanja
122
122
  OC;;Occitan (post 1500); Provençal
123
123
  OJ;;Ojibwa
124
124
  OR;;Oriya
125
125
  OM;;Oromo
126
- OS;;Isi-Rashiyani
126
+ OS;;Ossetian; Ossetic
127
127
  PA;;Panjabi; Punjabi
128
- PI;;Isi-Pholishi
128
+ PI;;Pali
129
129
  PL;;Isi-Pholishi
130
130
  PT;;Isi-Phuthukesi
131
131
  PS;;Pushto; Pashto
132
132
  QU;;Quechua
133
- RM;;Isi-Romayinani
134
- RO;;Isi-Lavithiyani
133
+ RM;;Romansh
134
+ RO;;Romanian; Moldavian; Moldovan
135
135
  RN;;Rundi
136
136
  RU;;Isi-Rashiyani
137
137
  SG;;Sango
138
138
  SA;;Sanskrit
139
- SI;;Isi-Vitheyinamise
139
+ SI;;Sinhala; Sinhalese
140
140
  SK;;Isi-Silovaki
141
141
  SL;;Isi-Siloveniyani
142
142
  SE;;Northern Sami
143
143
  SM;;Samoan
144
- SN;;Isi-Xhosa
144
+ SN;;Shona
145
145
  SD;;Sindhi
146
146
  SO;;Somali
147
147
  ST;;Sotho, Southern
148
148
  ES;;Spanish; Castilian
149
- SQ;;Isi-Azerbaijani
150
- SC;;Isi-Makhedoniya
149
+ SQ;;Albanian
150
+ SC;;Sardinian
151
151
  SR;;Isi-Sebhiyani
152
152
  SS;;Swati
153
153
  SU;;Sundanese
154
154
  SW;;Swahili
155
155
  SV;;Isi-Swedishi
156
- TY;;Isi-Lavithiyani
156
+ TY;;Tahitian
157
157
  TA;;Isi-Thamili
158
158
  TT;;Tatar
159
159
  TE;;Telugu
160
- TG;;Isi-Thayi
160
+ TG;;Tajik
161
161
  TL;;Tagalog
162
162
  TH;;Isi-Thayi
163
- TI;;Isi-Thekishi
163
+ TI;;Tigrinya
164
164
  TO;;Tonga (Tonga Islands)
165
165
  TN;;Tswana
166
166
  TS;;Tsonga
@@ -168,7 +168,7 @@ TK;;Turkmen
168
168
  TR;;Isi-Thekishi
169
169
  TW;;Twi
170
170
  UG;;Uighur; Uyghur
171
- UK;;Isi-Ukraniyani
171
+ UK;;Ukrainian
172
172
  UR;;Urdu
173
173
  UZ;;Uzbek
174
174
  VE;;Venda
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require 'simple_po_parser'
2
3
 
3
4
  module I18nData
4
5
  # fetches data online from debian git
@@ -42,20 +43,21 @@ module I18nData
42
43
  end
43
44
  end
44
45
 
45
- def translate(type, language, to_language_code)
46
- translated = translations(type, to_language_code)[language]
47
- translated.to_s.empty? ? nil : translated
48
- end
49
-
50
46
  def translated(type, language_code)
51
47
  @translated ||= {}
48
+
52
49
  @translated["#{type}_#{language_code}"] ||= begin
53
- Hash[send("english_#{type}").map do |code, name|
54
- [code, translate(type, name, language_code) || name]
50
+ Hash[send("alpha_codes_for_#{type}").map do |alpha2, alpha3|
51
+ [alpha2, translate(type, alpha3, language_code) || fallback_name(type, alpha3)]
55
52
  end]
56
53
  end
57
54
  end
58
55
 
56
+ def translate(type, alpha3, to_language_code)
57
+ translated = translations(type, to_language_code)[alpha3]
58
+ translated.to_s.empty? ? nil : translated
59
+ end
60
+
59
61
  def translations(type, language_code)
60
62
  @translations ||= {}
61
63
  @translations["#{type}_#{language_code}"] ||= begin
@@ -63,16 +65,50 @@ module I18nData
63
65
  code[0].downcase!
64
66
  code = code.join("_")
65
67
 
66
- url = TRANSLATIONS[type]+"#{code}.po"
67
68
  begin
68
- data = get(url)
69
+ file_path = "#{CLONE_DEST}/#{TRANSLATIONS[type]}#{code}.po"
70
+ data = SimplePoParser.parse(file_path)
71
+ data = data[1..-1] # Remove the initial info block in the .po file
72
+
73
+ # Prefer the "Common name for" blocks, but fallback to "Name for" blocks
74
+ common_names = get_po_data(data, 'Common name for')
75
+ fallback_names = get_po_data(data, 'Name for')
76
+
77
+ fallback_names.merge(common_names)
69
78
  rescue Errno::ENOENT
70
79
  raise NoTranslationAvailable, "for #{type} and language code = #{code} (#{$!})"
71
80
  end
81
+ end
82
+ end
83
+
84
+ def get_po_data(data, extracted_comment_string)
85
+ # Ignores the 'fuzzy' entries
86
+ po_entries = data.select do |t|
87
+ t[:extracted_comment].start_with?(extracted_comment_string) && t[:flag] != 'fuzzy'
88
+ end
89
+
90
+ # Maps over the alpha3 country code in the 'extracted_comment'
91
+ # Eg: "Name for GBR"
92
+ po_entries.map.with_object({}) do |t, translations|
93
+ alpha3 = t[:extracted_comment][-3..-1].upcase
94
+ translation = t[:msgstr]
95
+ translations[alpha3] = translation.is_a?(Array) ? translation.join : translation
96
+ end
97
+ end
72
98
 
73
- data = data.force_encoding('utf-8') if data.respond_to?(:force_encoding) # 1.9
74
- data = data.split("\n")
75
- po_to_hash data
99
+ def alpha_codes_for_countries
100
+ @alpha_codes_for_countries ||= json(:countries)['3166-1'].each_with_object({}) do |entry, codes|
101
+ alpha2 = entry['alpha_2']&.upcase
102
+ alpha3 = entry['alpha_3']&.upcase
103
+ codes[alpha2] = alpha3 unless alpha2.nil?
104
+ end
105
+ end
106
+
107
+ def alpha_codes_for_languages
108
+ @alpha_codes_for_languages ||= json(:languages)['639-2'].each_with_object({}) do |entry, codes|
109
+ alpha2 = entry['alpha_2']&.upcase
110
+ alpha3 = entry['alpha_3']&.upcase
111
+ codes[alpha2] = alpha3 unless alpha2.nil?
76
112
  end
77
113
  end
78
114
 
@@ -101,13 +137,8 @@ module I18nData
101
137
  end
102
138
  end
103
139
 
104
- def po_to_hash(data)
105
- names = data.select{|l| l =~ /^msgid/ }.map{|line| line.match(/^msgid "(.*?)"/)[1] }
106
- translations = data.select{|l| l =~ /^msgstr/ }.map{|line| line.match(/^msgstr "(.*?)"/)[1] }
107
-
108
- Hash[names.each_with_index.map do |name,index|
109
- [name, translations[index]]
110
- end]
140
+ def fallback_name(type, alpha3)
141
+ send("english_#{type}")[send("alpha_codes_for_#{type}").invert[alpha3]]
111
142
  end
112
143
 
113
144
  def get(url)
@@ -1,3 +1,3 @@
1
1
  module I18nData
2
- VERSION = Version = "0.12.0"
2
+ VERSION = Version = "0.15.0"
3
3
  end
data/lib/i18n_data.rb CHANGED
@@ -78,7 +78,7 @@ module I18nData
78
78
  options.each do |code, name|
79
79
  # support "Dutch" and "Dutch; Flemish", checks for inclusion first to skip the splitting
80
80
  # then check for exact match
81
- return code if name.include?(search) && (name == search || name.split(';').each(&:strip!).include?(search))
81
+ return code if name.include?(search) && (name == search || name.split('; ').include?(search))
82
82
  end
83
83
  end
84
84
 
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-03 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2021-12-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: simple_po_parser
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
13
27
  description:
14
28
  email: michael@grosser.it
15
29
  executables: []
@@ -82,7 +96,6 @@ files:
82
96
  - cache/file_data_provider/countries-KM.txt
83
97
  - cache/file_data_provider/countries-KN.txt
84
98
  - cache/file_data_provider/countries-KO.txt
85
- - cache/file_data_provider/countries-KU.txt
86
99
  - cache/file_data_provider/countries-KV.txt
87
100
  - cache/file_data_provider/countries-KW.txt
88
101
  - cache/file_data_provider/countries-KY.txt
@@ -251,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
264
  - !ruby/object:Gem::Version
252
265
  version: '0'
253
266
  requirements: []
254
- rubygems_version: 3.1.2
267
+ rubygems_version: 3.2.16
255
268
  signing_key:
256
269
  specification_version: 4
257
270
  summary: country/language names and 2-letter-code pairs, in 85 languages
@@ -1,249 +0,0 @@
1
- AW;;Aruba
2
- AF;;Efxanistan
3
- AO;;Angola
4
- AI;;Angîla
5
- AX;;Giravên Åland
6
- AL;;Arnavût
7
- AD;;Andora
8
- AE;;Mîrtiyên Ereb ên Yekbuyî
9
- AR;;Arjantîn
10
- AM;;Ermenistan
11
- AS;;Samoya Emerîkî
12
- AQ;;Antarktîka
13
- TF;;Herêma Basurî ya Fransî
14
- AG;;Antîguya û Barbuda
15
- AU;;Awustralya
16
- AT;;Awusturya
17
- AZ;;Azerbaycan
18
- BI;;Bûrûndî
19
- BE;;Belçîka
20
- BJ;;Benîn
21
- BQ;;Bonaire, Sint Eustatius û Saba
22
- BF;;Burkîna Faso
23
- BD;;Banglades
24
- BG;;Bulgaristan
25
- BH;;Bahrayîn
26
- BS;;Giravên Bahama
27
- BA;;Bosna Hersek
28
- BL;;Saint Barthélemy
29
- BY;;Belarus
30
- BZ;;Belîze
31
- BM;;Bermûda
32
- BO;;Bolîvya
33
- BR;;Brezîlya
34
- BB;;Barbados
35
- BN;;Brûney Darûssalam
36
- BT;;Bûtan
37
- BV;;Girava Boyuvet
38
- BW;;Botswana
39
- CF;;Komara Afrikaya Navîn
40
- CA;;Kanada
41
- CC;;Grava Kokos (Kîlîng)
42
- CH;;Swîsre
43
- CL;;Sîlî
44
- CN;;Çîn
45
- CI;;Sahila Diranên Fîlan
46
- CM;;Kamerûn
47
- CD;;Komara Demokratîk a Kongo
48
- CG;;Kongo
49
- CK;;Giravên Cook
50
- CO;;Kolombiya
51
- KM;;Komoros
52
- CV;;Kap Verde
53
- CR;;Kosta Rîka
54
- CU;;Kûba
55
- CW;;Curaçao
56
- CX;;Girava Noel
57
- KY;;Giravên Kayman
58
- CY;;Kibris
59
- CZ;;Çekistan
60
- DE;;Almanya
61
- DJ;;Cîbutî
62
- DM;;Domînîka
63
- DK;;Danîmarka
64
- DO;;Komara Domînîk
65
- DZ;;Cezayîr
66
- EC;;Ekvator
67
- EG;;Misir
68
- ER;;Erître
69
- EH;;Sehraya Rojava
70
- ES;;Spanya
71
- EE;;Estonya
72
- ET;;Etîyopya
73
- FI;;Fînlandiya
74
- FJ;;Fîjî
75
- FK;;Giravên Falkland (Malvin)
76
- FR;;Fransa
77
- FO;;Giravên Faroye
78
- FM;;Mîkronesya, Dewletên Federal yên
79
- GA;;Gabon
80
- GB;;Şahitiya Yekbuyî
81
- GE;;Gurcistan
82
- GG;;Guernsey
83
- GH;;Gana
84
- GI;;Cebelîtariq
85
- GN;;Gîne
86
- GP;;Guadelûp
87
- GM;;Gambiya
88
- GW;;Gîneya Bisoî
89
- GQ;;Gîneya Ekvatorî
90
- GR;;Yewnanistan
91
- GD;;Girava Grenada
92
- GL;;Greenland
93
- GT;;Guatemala
94
- GF;;Gîneya Fransî
95
- GU;;Guam
96
- GY;;Guyana
97
- HK;;Hong Kong
98
- HM;;Giravên Heard û McDonald
99
- HN;;Honduras
100
- HR;;Hirvatistan
101
- HT;;Haîtî
102
- HU;;Macaristan
103
- ID;;Endonezya
104
- IM;;Girava Man
105
- IN;;Hindistan
106
- IO;;Herêma Îngîlîz a Deryaya Hindî
107
- IE;;Îrlanda
108
- IR;;Îran, Komara Îslamî ya
109
- IQ;;Iraq
110
- IS;;Îzlanda
111
- IL;;Îsraîl
112
- IT;;Îtalya
113
- JM;;Jamayîka
114
- JE;;Jersey
115
- JO;;Urdin
116
- JP;;Japonya
117
- KZ;;Kazaxstan
118
- KE;;Kenya
119
- KG;;Kirgîsistan
120
- KH;;Kamboca
121
- KI;;Kirîbatî
122
- KN;;Saint Kitts û Nevis
123
- KR;;Kore, Komara
124
- KW;;Kûveyt
125
- LA;;Komara Demokratîka Gelê Lao
126
- LB;;Lubnan
127
- LR;;Lîberya
128
- LY;;Lîbya
129
- LC;;Saint Lucia
130
- LI;;Lihtenstayn
131
- LK;;Srî Lanka
132
- LS;;Lesoto
133
- LT;;Lîtvanya
134
- LU;;Luksemburg
135
- LV;;Latviya
136
- MO;;Makao
137
- MF;;Saint Martin (beşa firansî)
138
- MA;;Fas
139
- MC;;Monako
140
- MD;;Moldova
141
- MG;;Madagaskar
142
- MV;;Giravên Maldiv
143
- MX;;Mexîko
144
- MH;;Giravên Marsal
145
- MK;;Kaledonyaya Nû
146
- ML;;Malî
147
- MT;;Malta
148
- MM;;Miyanmar
149
- ME;;Montenegro
150
- MN;;Mongolya
151
- MP;;Giravên Marîyana Bakûr
152
- MZ;;Mozambîk
153
- MR;;Morîtanya
154
- MS;;Montserat
155
- MQ;;Martinîk
156
- MU;;Morîtiyus
157
- MW;;Malawî
158
- MY;;Malezya
159
- YT;;Mayote
160
- NA;;Namîbiya
161
- NC;;Kaledonyaya Nû
162
- NE;;Nîjer
163
- NF;;Girava Norfolk
164
- NG;;Nîjerya
165
- NI;;Nîkaragûa
166
- NU;;Nîûe
167
- NL;;Holanda
168
- NO;;Norweç
169
- NP;;Nepal
170
- NR;;Naûrû
171
- NZ;;Zelandaya Nû
172
- OM;;Uman
173
- PK;;Pakistan
174
- PA;;Panama
175
- PN;;Pitkayirn
176
- PE;;Perû
177
- PH;;Fîlîpîn
178
- PW;;Palawu
179
- PG;;Papûa Gîneya Nû
180
- PL;;Polonya
181
- PR;;Porto Rîko
182
- KP;;Kore, Komara Demokratîk a Gelê
183
- PT;;Portekîz
184
- PY;;Paraguay
185
- PS;;Palestine, State of
186
- PF;;Polînesya Fransî
187
- QA;;Qatar
188
- RE;;Reûnyon
189
- RO;;Romanya
190
- RU;;Federasyona Rûsî
191
- RW;;Rûanda
192
- SA;;Si'ûdî Erebistan
193
- SD;;Sûdan
194
- SN;;Senegal
195
- SG;;Sîngapur
196
- GS;;Georgiaya Basûr û Giravên Sandwicha Basûr
197
- SH;;Saint Helena, Ascension and Tristan da Cunha
198
- SJ;;Svalbard û Jan Mayen
199
- SB;;Giravên Solomon
200
- SL;;Sîera Leone
201
- SV;;El Salvador
202
- SM;;San Marîno
203
- SO;;Somalî
204
- PM;;Saint Pierre û Miquelon
205
- RS;;Sirbistan
206
- SS;;Komara Sûdan
207
- ST;;Sao Tome û Prinsipe
208
- SR;;Surînam
209
- SK;;Slovakya
210
- SI;;Slovenya
211
- SE;;Swêd
212
- SZ;;Eswatini
213
- SX;;Saint Martin (beşa firansî)
214
- SC;;Seyselan
215
- SY;;Sûriye
216
- TC;;Giravên Turks û Caicos
217
- TD;;Çad
218
- TG;;Togo
219
- TH;;Tayland
220
- TJ;;Tacîkistan
221
- TK;;Tokelau
222
- TM;;Tirkmenîstan
223
- TL;;Tîmora Rojhilat
224
- TO;;Tonga
225
- TT;;Trînîdad û Tobago
226
- TN;;Tûnis
227
- TR;;Tirkiye
228
- TV;;Tûvalû
229
- TW;;Taywan
230
- TZ;;Tanzania
231
- UG;;Ûganda
232
- UA;;Ukrayna
233
- UM;;Giravên biçûk derve Emerîkayê
234
- UY;;Uruguay
235
- US;;Dewletên Yekbûyî
236
- UZ;;Ozbekîstan
237
- VA;;Texta Pîroz (Dewleta Bajarî ya Vatîkan)
238
- VC;;Saint Vincent û Grenadines
239
- VE;;Venezûela
240
- VG;;Giravên Virjin, Brîtanî
241
- VI;;Giravên Virjin, D.Y.
242
- VN;;Viyetnam
243
- VU;;Vanûatû
244
- WF;;Walis û Futuna
245
- WS;;Samoa
246
- YE;;Yemen
247
- ZA;;Efrîka Basur
248
- ZM;;Zambiya
249
- ZW;;Zimbabwe