Commit d2b6e21e5ac7d85254523032d771fd8b65515284

Authored by Antonio Terceiro
1 parent 4dcb9b6e

ActionItem941: internationalized country selector

app/helpers/countries_helper.rb 0 → 100644
... ... @@ -0,0 +1,264 @@
  1 +class CountriesHelper
  2 +
  3 + include GetText
  4 + bindtextdomain 'iso_3166'
  5 +
  6 + # a dump of iso_3166.xml from Debian source package iso-codes
  7 + COUNTRIES = [
  8 + ["Afghanistan", "AF"],
  9 + ["Åland Islands", "AX"],
  10 + ["Albania", "AL"],
  11 + ["Algeria", "DZ"],
  12 + ["American Samoa", "AS"],
  13 + ["Andorra", "AD"],
  14 + ["Angola", "AO"],
  15 + ["Anguilla", "AI"],
  16 + ["Antarctica", "AQ"],
  17 + ["Antigua and Barbuda", "AG"],
  18 + ["Argentina", "AR"],
  19 + ["Armenia", "AM"],
  20 + ["Aruba", "AW"],
  21 + ["Australia", "AU"],
  22 + ["Austria", "AT"],
  23 + ["Azerbaijan", "AZ"],
  24 + ["Bahamas", "BS"],
  25 + ["Bahrain", "BH"],
  26 + ["Bangladesh", "BD"],
  27 + ["Barbados", "BB"],
  28 + ["Belarus", "BY"],
  29 + ["Belgium", "BE"],
  30 + ["Belize", "BZ"],
  31 + ["Benin", "BJ"],
  32 + ["Bermuda", "BM"],
  33 + ["Bhutan", "BT"],
  34 + ["Bolivia", "BO"],
  35 + ["Bosnia and Herzegovina", "BA"],
  36 + ["Botswana", "BW"],
  37 + ["Bouvet Island", "BV"],
  38 + ["Brazil", "BR"],
  39 + ["British Indian Ocean Territory", "IO"],
  40 + ["Brunei Darussalam", "BN"],
  41 + ["Bulgaria", "BG"],
  42 + ["Burkina Faso", "BF"],
  43 + ["Burundi", "BI"],
  44 + ["Cambodia", "KH"],
  45 + ["Cameroon", "CM"],
  46 + ["Canada", "CA"],
  47 + ["Cape Verde", "CV"],
  48 + ["Cayman Islands", "KY"],
  49 + ["Central African Republic", "CF"],
  50 + ["Chad", "TD"],
  51 + ["Chile", "CL"],
  52 + ["China", "CN"],
  53 + ["Christmas Island", "CX"],
  54 + ["Cocos (Keeling) Islands", "CC"],
  55 + ["Colombia", "CO"],
  56 + ["Comoros", "KM"],
  57 + ["Congo", "CG"],
  58 + ["Congo, The Democratic Republic of the", "CD"],
  59 + ["Cook Islands", "CK"],
  60 + ["Costa Rica", "CR"],
  61 + ["Côte d'Ivoire", "CI"],
  62 + ["Croatia", "HR"],
  63 + ["Cuba", "CU"],
  64 + ["Cyprus", "CY"],
  65 + ["Czech Republic", "CZ"],
  66 + ["Denmark", "DK"],
  67 + ["Djibouti", "DJ"],
  68 + ["Dominica", "DM"],
  69 + ["Dominican Republic", "DO"],
  70 + ["Ecuador", "EC"],
  71 + ["Egypt", "EG"],
  72 + ["El Salvador", "SV"],
  73 + ["Equatorial Guinea", "GQ"],
  74 + ["Eritrea", "ER"],
  75 + ["Estonia", "EE"],
  76 + ["Ethiopia", "ET"],
  77 + ["Falkland Islands (Malvinas)", "FK"],
  78 + ["Faroe Islands", "FO"],
  79 + ["Fiji", "FJ"],
  80 + ["Finland", "FI"],
  81 + ["France", "FR"],
  82 + ["French Guiana", "GF"],
  83 + ["French Polynesia", "PF"],
  84 + ["French Southern Territories", "TF"],
  85 + ["Gabon", "GA"],
  86 + ["Gambia", "GM"],
  87 + ["Georgia", "GE"],
  88 + ["Germany", "DE"],
  89 + ["Ghana", "GH"],
  90 + ["Gibraltar", "GI"],
  91 + ["Greece", "GR"],
  92 + ["Greenland", "GL"],
  93 + ["Grenada", "GD"],
  94 + ["Guadeloupe", "GP"],
  95 + ["Guam", "GU"],
  96 + ["Guatemala", "GT"],
  97 + ["Guernsey", "GG"],
  98 + ["Guinea", "GN"],
  99 + ["Guinea-Bissau", "GW"],
  100 + ["Guyana", "GY"],
  101 + ["Haiti", "HT"],
  102 + ["Heard Island and McDonald Islands", "HM"],
  103 + ["Holy See (Vatican City State)", "VA"],
  104 + ["Honduras", "HN"],
  105 + ["Hong Kong", "HK"],
  106 + ["Hungary", "HU"],
  107 + ["Iceland", "IS"],
  108 + ["India", "IN"],
  109 + ["Indonesia", "ID"],
  110 + ["Iran, Islamic Republic of", "IR"],
  111 + ["Iraq", "IQ"],
  112 + ["Ireland", "IE"],
  113 + ["Isle of Man", "IM"],
  114 + ["Israel", "IL"],
  115 + ["Italy", "IT"],
  116 + ["Jamaica", "JM"],
  117 + ["Japan", "JP"],
  118 + ["Jersey", "JE"],
  119 + ["Jordan", "JO"],
  120 + ["Kazakhstan", "KZ"],
  121 + ["Kenya", "KE"],
  122 + ["Kiribati", "KI"],
  123 + ["Korea, Democratic People's Republic of", "KP"],
  124 + ["Korea, Republic of", "KR"],
  125 + ["Kuwait", "KW"],
  126 + ["Kyrgyzstan", "KG"],
  127 + ["Lao People's Democratic Republic", "LA"],
  128 + ["Latvia", "LV"],
  129 + ["Lebanon", "LB"],
  130 + ["Lesotho", "LS"],
  131 + ["Liberia", "LR"],
  132 + ["Libyan Arab Jamahiriya", "LY"],
  133 + ["Liechtenstein", "LI"],
  134 + ["Lithuania", "LT"],
  135 + ["Luxembourg", "LU"],
  136 + ["Macao", "MO"],
  137 + ["Macedonia, Republic of", "MK"],
  138 + ["Madagascar", "MG"],
  139 + ["Malawi", "MW"],
  140 + ["Malaysia", "MY"],
  141 + ["Maldives", "MV"],
  142 + ["Mali", "ML"],
  143 + ["Malta", "MT"],
  144 + ["Marshall Islands", "MH"],
  145 + ["Martinique", "MQ"],
  146 + ["Mauritania", "MR"],
  147 + ["Mauritius", "MU"],
  148 + ["Mayotte", "YT"],
  149 + ["Mexico", "MX"],
  150 + ["Micronesia, Federated States of", "FM"],
  151 + ["Moldova", "MD"],
  152 + ["Monaco", "MC"],
  153 + ["Mongolia", "MN"],
  154 + ["Montenegro", "ME"],
  155 + ["Montserrat", "MS"],
  156 + ["Morocco", "MA"],
  157 + ["Mozambique", "MZ"],
  158 + ["Myanmar", "MM"],
  159 + ["Namibia", "NA"],
  160 + ["Nauru", "NR"],
  161 + ["Nepal", "NP"],
  162 + ["Netherlands", "NL"],
  163 + ["Netherlands Antilles", "AN"],
  164 + ["New Caledonia", "NC"],
  165 + ["New Zealand", "NZ"],
  166 + ["Nicaragua", "NI"],
  167 + ["Niger", "NE"],
  168 + ["Nigeria", "NG"],
  169 + ["Niue", "NU"],
  170 + ["Norfolk Island", "NF"],
  171 + ["Northern Mariana Islands", "MP"],
  172 + ["Norway", "NO"],
  173 + ["Oman", "OM"],
  174 + ["Pakistan", "PK"],
  175 + ["Palau", "PW"],
  176 + ["Palestinian Territory, Occupied", "PS"],
  177 + ["Panama", "PA"],
  178 + ["Papua New Guinea", "PG"],
  179 + ["Paraguay", "PY"],
  180 + ["Peru", "PE"],
  181 + ["Philippines", "PH"],
  182 + ["Pitcairn", "PN"],
  183 + ["Poland", "PL"],
  184 + ["Portugal", "PT"],
  185 + ["Puerto Rico", "PR"],
  186 + ["Qatar", "QA"],
  187 + ["Reunion", "RE"],
  188 + ["Romania", "RO"],
  189 + ["Russian Federation", "RU"],
  190 + ["Rwanda", "RW"],
  191 + ["Saint Barthélemy", "BL"],
  192 + ["Saint Helena", "SH"],
  193 + ["Saint Kitts and Nevis", "KN"],
  194 + ["Saint Lucia", "LC"],
  195 + ["Saint Martin (French part)", "MF"],
  196 + ["Saint Pierre and Miquelon", "PM"],
  197 + ["Saint Vincent and the Grenadines", "VC"],
  198 + ["Samoa", "WS"],
  199 + ["San Marino", "SM"],
  200 + ["Sao Tome and Principe", "ST"],
  201 + ["Saudi Arabia", "SA"],
  202 + ["Senegal", "SN"],
  203 + ["Serbia", "RS"],
  204 + ["Seychelles", "SC"],
  205 + ["Sierra Leone", "SL"],
  206 + ["Singapore", "SG"],
  207 + ["Slovakia", "SK"],
  208 + ["Slovenia", "SI"],
  209 + ["Solomon Islands", "SB"],
  210 + ["Somalia", "SO"],
  211 + ["South Africa", "ZA"],
  212 + ["South Georgia and the South Sandwich Islands", "GS"],
  213 + ["Spain", "ES"],
  214 + ["Sri Lanka", "LK"],
  215 + ["Sudan", "SD"],
  216 + ["Suriname", "SR"],
  217 + ["Svalbard and Jan Mayen", "SJ"],
  218 + ["Swaziland", "SZ"],
  219 + ["Sweden", "SE"],
  220 + ["Switzerland", "CH"],
  221 + ["Syrian Arab Republic", "SY"],
  222 + ["Taiwan", "TW"],
  223 + ["Tajikistan", "TJ"],
  224 + ["Tanzania, United Republic of", "TZ"],
  225 + ["Thailand", "TH"],
  226 + ["Timor-Leste", "TL"],
  227 + ["Togo", "TG"],
  228 + ["Tokelau", "TK"],
  229 + ["Tonga", "TO"],
  230 + ["Trinidad and Tobago", "TT"],
  231 + ["Tunisia", "TN"],
  232 + ["Turkey", "TR"],
  233 + ["Turkmenistan", "TM"],
  234 + ["Turks and Caicos Islands", "TC"],
  235 + ["Tuvalu", "TV"],
  236 + ["Uganda", "UG"],
  237 + ["Ukraine", "UA"],
  238 + ["United Arab Emirates", "AE"],
  239 + ["United Kingdom", "GB"],
  240 + ["United States", "US"],
  241 + ["United States Minor Outlying Islands", "UM"],
  242 + ["Uruguay", "UY"],
  243 + ["Uzbekistan", "UZ"],
  244 + ["Vanuatu", "VU"],
  245 + ["Venezuela", "VE"],
  246 + ["Viet Nam", "VN"],
  247 + ["Virgin Islands, British", "VG"],
  248 + ["Virgin Islands, U.S.", "VI"],
  249 + ["Wallis and Futuna", "WF"],
  250 + ["Western Sahara", "EH"],
  251 + ["Yemen", "YE"],
  252 + ["Zambia", "ZM"],
  253 + ["Zimbabwe", "ZW"]
  254 + ]
  255 +
  256 + def self.countries
  257 + COUNTRIES
  258 + end
  259 +
  260 + def countries
  261 + self.class.countries.map {|item| [gettext(item[0]), item[1] ]}.sort_by { |entry| entry.first.transliterate }
  262 + end
  263 +
  264 +end
... ...
app/helpers/profile_editor_helper.rb
... ... @@ -81,252 +81,6 @@ module ProfileEditorHelper
81 81 N_('Others')
82 82 ]
83 83  
84   - COUNTRIES = [
85   - ("Afeganistão (افغانستان)"),
86   - ("África do Sul (South Africa)"),
87   - ("Albânia (Shqipëria)"),
88   - ("Alemanha (Deutschland)"),
89   - ("Andorra"),
90   - ("Angola"),
91   - ("Anguila (Anguilla)"),
92   - ("Antártica (Antarctica)"),
93   - ("Antígua e Barbuda (Antigua and Barbuda)"),
94   - ("Antilhas Holandesas (Netherlands Antilles)"),
95   - ("Arábia Saudita (العربية السعودية)"),
96   - ("Argélia (الجمهورية الجزائرية)"),
97   - ("Argentina"),
98   - ("Armênia (Հայաստան)"),
99   - ("Aruba"),
100   - ("Austrália (Australia)"),
101   - ("Áustria (Österreich)"),
102   - ("Azerbaijão (Azərbaycan)"),
103   - ("Bahamas"),
104   - ("Bangladesh (বাংলাদেশ)"),
105   - ("Barbados"),
106   - ("Barein (بحرين)"),
107   - ("Bélgica (België)"),
108   - ("Belize"),
109   - ("Benin (Bénin)"),
110   - ("Bermudas (Bermuda)"),
111   - ("Bielo-Rússia (Белару́сь)"),
112   - ("Bolívia (Bolivia)"),
113   - ("Bósnia-Herzegovina (Bosna i Hercegovina)"),
114   - ("Botsuana (Botswana)"),
115   - ("Brasil"),
116   - ("Brunei (Brunei Darussalam)"),
117   - ("Bulgária (България)"),
118   - ("Burkina Fasso (Burkina Faso)"),
119   - ("Burundi (Uburundi)"),
120   - ("Butão (འབྲུག་ཡུལ)"),
121   - ("Cabo Verde"),
122   - ("Camarões (Cameroun)"),
123   - ("Camboja (Kampuchea)"),
124   - ("Canadá (Canada)"),
125   - ("Catar (قطر)"),
126   - ("Cazaquistão (Қазақстан)"),
127   - ("Chade (Tchad)"),
128   - ("Chile"),
129   - ("China (中国)"),
130   - ("Chipre (Κυπρος)"),
131   - ("Cidade do Vaticano (Città del Vaticano)"),
132   - ("Cingapura (Singapura)"),
133   - ("Colômbia (Colombia)"),
134   - ("Comores"),
135   - ("Congo"),
136   - ("Congo, República democrática do (Congo, Democratic Republic of the)"),
137   - ("Coréia do Norte (조선)"),
138   - ("Coréia do Sul (한국)"),
139   - ("Costa do Marfim (Côte d'Ivoire)"),
140   - ("Costa Rica"),
141   - ("Croácia (Hrvatska)"),
142   - ("Cuba"),
143   - ("Dinamarca (Danmark)"),
144   - ("Djibuti (Djibouti)"),
145   - ("Dominica"),
146   - ("Egito (مصر)"),
147   - ("El Salvador"),
148   - ("Emirados Árabes Unidos (الإمارات العربيّة المتّحد)"),
149   - ("Equador (Ecuador)"),
150   - ("Eritréia (Ertra)"),
151   - ("Eslováquia (Slovensko)"),
152   - ("Eslovênia (Slovenija)"),
153   - ("Espanha (España)"),
154   - ("Estados Unidos (United States)"),
155   - ("Estônia (Eesti)"),
156   - ("Etiópia (Ityop'iya)"),
157   - ("Fiji"),
158   - ("Filipinas (Pilipinas)"),
159   - ("Finlândia (Suomi)"),
160   - ("França (France)"),
161   - ("Gabão (Gabon)"),
162   - ("Gâmbia (Gambia)"),
163   - ("Gana (Ghana)"),
164   - ("Geórgia (საქართველო)"),
165   - ("Geórgia do Sul e Ilhas Sandwich do Sul (South Georgia and the South Sandwich Islands)"),
166   - ("Gibraltar"),
167   - ("Granada (Grenada)"),
168   - ("Grécia (Eλλας)"),
169   - ("Groenlândia (Greenland)"),
170   - ("Guadalupe (Guadeloupe)"),
171   - ("Guam"),
172   - ("Guatemala"),
173   - ("Guernsey"),
174   - ("Guiana (Guyana)"),
175   - ("Guiana Francesa (French Guiana)"),
176   - ("Guiné (Guinée)"),
177   - ("Guiné-Bissau"),
178   - ("Guiné Equatorial (Guinea Ecuatorial)"),
179   - ("Haiti (Haïti)"),
180   - ("Holanda (Nederland)"),
181   - ("Honduras"),
182   - ("Hong Kong"),
183   - ("Hungria (Magyarország)"),
184   - ("Iêmen (اليمن)"),
185   - ("Ilha Aland (Aland Islands)"),
186   - ("Ilha Bouvet (Bouvet Island)"),
187   - ("Ilha Christmas (Christmas Island)"),
188   - ("Ilha de Man (Isle of Man)"),
189   - ("Ilha Norfolk (Norfolk Island)"),
190   - ("Ilhas Cayman (Cayman Islands)"),
191   - ("Ilhas Cocos (Keeling) (Cocos Islands)"),
192   - ("Ilhas Cook (Cook Islands)"),
193   - ("Ilhas Falkland (Malvinas) (Falkland Islands)"),
194   - ("Ilhas Faroé (Faroe Islands)"),
195   - ("Ilhas Heard e McDonald (Heard Island and McDonald Islands)"),
196   - ("Ilhas Marianas do Norte (Northern Mariana Islands)"),
197   - ("Ilhas Marshall (Marshall Islands)"),
198   - ("Ilhas Maurício (Mauritius)"),
199   - ("Ilhas Reunião (Reunion)"),
200   - ("Ilhas Salomão (Solomon Islands)"),
201   - ("Ilhas Svalbard e Jan Mayen (Svalbard and Jan Mayen)"),
202   - ("Ilhas Tokelau (Tokelau)"),
203   - ("Ilhas Turks e Caicos (Turks and Caicos Islands)"),
204   - ("Ilhas Virgens, Britânicas (Virgin Islands, British)"),
205   - ("Ilhas Virgens, EUA (Virgin Islands, U.S.)"),
206   - ("Ilhas Wallis e Futuna (Wallis and Futuna)"),
207   - ("Índia (India)"),
208   - ("Indonésia (Indonesia)"),
209   - ("Irã (ایران)"),
210   - ("Iraque (العراق)"),
211   - ("Irlanda (Ireland)"),
212   - ("Islândia (Ísland)"),
213   - ("Israel (ישראל)"),
214   - ("Itália (Italia)"),
215   - ("Jamaica"),
216   - ("Japão (日本)"),
217   - ("Jordânia (الارد)"),
218   - ("Kiribati"),
219   - ("Kuwait (الكويت)"),
220   - ("Laos (ນລາວ)"),
221   - ("Lesoto (Lesotho)"),
222   - ("Letônia (Latvija)"),
223   - ("Líbano (لبنان)"),
224   - ("Libéria (Liberia)"),
225   - ("Líbia (ليبية)"),
226   - ("Liechtenstein"),
227   - ("Lituânia (Lietuva)"),
228   - ("Luxemburgo (Lëtzebuerg)"),
229   - ("Macau (Macao)"),
230   - ("Macedônia (Македонија)"),
231   - ("Madagáscar (Madagasikara)"),
232   - ("Maiote (Mayotte)"),
233   - ("Malásia (Malaysia)"),
234   - ("Malavi (Malawi)"),
235   - ("Maldivas (ގުޖޭއްރާ ޔާއްރިހޫމްޖ)"),
236   - ("Mali"),
237   - ("Malta"),
238   - ("Marrocos (مغرب)"),
239   - ("Martinica (Martinique)"),
240   - ("Mauritânia (موريتانية)"),
241   - ("México"),
242   - ("Micronésia (Micronesia)"),
243   - ("Moçambique"),
244   - ("Moldávia (Moldova)"),
245   - ("Mônaco (Monaco)"),
246   - ("Mongólia (Монгол Улс)"),
247   - ("Montserrat"),
248   - ("Myanmar (Լեռնային Ղարաբաղ)"),
249   - ("Namíbia (Namibia)"),
250   - ("Nauru (Naoero)"),
251   - ("Nepal (नेपाल)"),
252   - ("Nicarágua (Nicaragua)"),
253   - ("Níger (Niger)"),
254   - ("Nigéria (Nigeria)"),
255   - ("Niue"),
256   - ("Noruega (Norge)"),
257   - ("Nova Caledônia (New Caledonia)"),
258   - ("Nova Jérsei (Jersey)"),
259   - ("Nova Zelândia (New Zealand)"),
260   - ("Omã (عمان)"),
261   - ("Palau (Belau)"),
262   - ("Palestina (Palestine)"),
263   - ("Panamá"),
264   - ("Papua-Nova Guiné (Papua New Guinea)"),
265   - ("Paquistão (پاکستان)"),
266   - ("Paraguai (Paraguay)"),
267   - ("Peru (Perú)"),
268   - ("Pitcairn"),
269   - ("Polinésia Francesa (French Polynesia)"),
270   - ("Polônia (Polska)"),
271   - ("Porto Rico (Puerto Rico)"),
272   - ("Portugal"),
273   - ("Quênia (Kenya)"),
274   - ("Quirquistão (Кыргызстан)"),
275   - ("Reino Unido (United Kingdom)"),
276   - ("República Centro-Africana (République Centrafricaine)"),
277   - ("República Dominicana (Dominican Republic)"),
278   - ("República Tcheca (Česko)"),
279   - ("Romênia (România)"),
280   - ("Ruanda (Rwanda)"),
281   - ("Rússia (Россия)"),
282   - ("Saara Ocidental (صحراوية)"),
283   - ("Samoa"),
284   - ("Samoa Americana (American Samoa)"),
285   - ("San Marino"),
286   - ("Santa Helena (Saint Helena)"),
287   - ("Santa Lúcia (Saint Lucia)"),
288   - ("São Cristóvão e Névis (Saint Kitts and Nevis)"),
289   - ("São Pierre e Miquelon (Saint Pierre and Miquelon)"),
290   - ("São Tomé e Príncipe (São Tomé and Príncipe)"),
291   - ("São Vincente e Granadinas (Saint Vincent and the Grenadines)"),
292   - ("Seicheles (Seychelles)"),
293   - ("Senegal (Sénégal)"),
294   - ("Serra Leoa (Sierra Leone)"),
295   - ("Sérvia e Montenegro (Србија и Црна Гора)"),
296   - ("Síria (سورية)"),
297   - ("Somália (Soomaaliya)"),
298   - ("Sri Lanka"),
299   - ("Suazilândia (Swaziland)"),
300   - ("Sudão (السودان)"),
301   - ("Suécia (Sverige)"),
302   - ("Suíça (Schweiz)"),
303   - ("Suriname"),
304   - ("Tailândia (ราชอาณาจักรไทย)"),
305   - ("Taiwan (台灣)"),
306   - ("Tajiquistão (Тоҷикистон)"),
307   - ("Tanzânia (Tanzania)"),
308   - ("Território Britânico do Oceano Índico (British Indian Ocean Territory)"),
309   - ("Territórios Franceses do Sul (French Southern Territories)"),
310   - ("Territórios Insulares dos Estados Unidos (United States minor outlying islands)"),
311   - ("Timor Leste (Timor-Leste)"),
312   - ("Togo"),
313   - ("Tonga"),
314   - ("Trinidad e Tobago (Trinidad and Tobago)"),
315   - ("Tunísia (تونس)"),
316   - ("Turcomenistão (Türkmenistan)"),
317   - ("Turquia (Türkiye)"),
318   - ("Tuvalu"),
319   - ("Ucrânia (Україна)"),
320   - ("Uganda"),
321   - ("Uruguai (Uruguay)"),
322   - ("Uzbequistão (O'zbekiston)"),
323   - ("Vanuatu"),
324   - ("Venezuela"),
325   - ("Vietnã (Việt Nam)"),
326   - ("Zâmbia (Zambia)"),
327   - ("Zimbábue (Zimbabwe)")
328   - ]
329   -
330 84 SCHOOLING = [
331 85 N_('Post-Doctoral'),
332 86 N_('Ph.D.'),
... ... @@ -347,8 +101,12 @@ module ProfileEditorHelper
347 101 labelled_form_field(title, select(object, method, [[_('[Select ...]'), nil]] + ProfileEditorHelper::AREAS_OF_STUDY.map{|s| [gettext(s), s]}, {}, options))
348 102 end
349 103  
  104 + def country_helper
  105 + @country_helper ||= CountriesHelper.new
  106 + end
  107 +
350 108 def select_country(title, object, method, options)
351   - labelled_form_field(title, select(object, method, [[_('[Select ...]'), nil]] + ProfileEditorHelper::COUNTRIES.map{|s| [s]}, {}, options))
  109 + labelled_form_field(title, select(object, method, [[_('[Select ...]'), nil]] + country_helper.countries, {}, options))
352 110 end
353 111  
354 112 def select_schooling(object, method, options)
... ...
doc/README_FOR_APP.en
... ... @@ -21,10 +21,11 @@ You need to have a Subversion client (svn) installed, as well as:
21 21 * Ruby Locale: http://rubyforge.org/projects/locale/
22 22 * will_paginate: http://github.com/mislav/will_paginate/wikis
23 23 * contacts: http://github.com/cardmagic/contacts/tree/master
  24 +* iso-codes: http://pkg-isocodes.alioth.debian.org/
24 25  
25 26 There are Debian packages available for all of them but ferret. Try:
26 27  
27   - # aptitude install subversion ruby rake libgettext-ruby libmocha-ruby libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby liblocale-ruby libwill-paginate-ruby
  28 + # aptitude install subversion ruby rake libgettext-ruby libmocha-ruby libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby liblocale-ruby libwill-paginate-ruby iso-codes
28 29  
29 30 Ferret shall enter Debian soon (as <tt>libferret-ruby</tt>). until there you have two options:
30 31  
... ...
lib/noosfero/core_ext/string.rb
1 1 class String
2 2  
3 3 TRANSLITERATIONS = {
4   - [ 'Á', 'À', 'À', 'Â', 'Ã', 'Ä' ] => 'A',
5   - [ 'á', 'à', 'à', 'â', 'ã', 'ä', 'ª' ] => 'a',
  4 + [ 'Á', 'À', 'À', 'Â', 'Ã', 'Ä', 'Å' ] => 'A',
  5 + [ 'á', 'à', 'à', 'â', 'ã', 'ä', 'å' ,'ª' ] => 'a',
6 6 [ 'É', 'È', 'Ê', 'Ë' ] => 'E',
7 7 [ 'é', 'è', 'ê', 'ë' ] => 'e',
8 8 [ 'Í', 'Ì', 'Î', 'Ï' ] => 'I',
... ...
test/unit/countries_helper_test.rb 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +require File.dirname(__FILE__) + '/../test_helper'
  2 +
  3 +class CountriesHelperTest < Test::Unit::TestCase
  4 +
  5 + def setup
  6 + @helper = CountriesHelper.new
  7 + end
  8 + attr_reader :helper
  9 +
  10 + should 'provide ISO-3166 list of countries' do
  11 + assert_kind_of Array, CountriesHelper.countries
  12 +
  13 + # test some familiar countries and trust the rest is OK.
  14 + assert CountriesHelper.countries.any? { |entry| entry.first == 'Brazil' }
  15 + assert CountriesHelper.countries.any? { |entry| entry.first == 'France' }
  16 + assert CountriesHelper.countries.any? { |entry| entry.first == 'Switzerland' }
  17 + end
  18 +
  19 + should 'translate country names' do
  20 + CountriesHelper.stubs(:countries).returns([["Brazil", "BR"],["France", "FR"]])
  21 + helper.expects(:gettext).with("Brazil").returns("Brasil")
  22 + helper.expects(:gettext).with("France").returns("França")
  23 + assert_equal [["Brasil", "BR"], ["França", "FR"]], helper.countries
  24 + end
  25 +
  26 + should 'sort alphabetically by the translated names' do
  27 + CountriesHelper.stubs(:countries).returns([["Brazil", "BR"], ["Argentina", "AR"]])
  28 + assert_equal [["Argentina", "AR"], ["Brazil", "BR"]], helper.countries
  29 + end
  30 +
  31 + should 'sort respecting utf-8 ordering (or something like that)' do
  32 + CountriesHelper.stubs(:countries).returns([["Brazil", "BR"], ["Åland Islands", "AX"]])
  33 + assert_equal [["Åland Islands", "AX"], ["Brazil", "BR"]], helper.countries
  34 + end
  35 +
  36 +end
... ...
test/unit/string_core_ext_test.rb
... ... @@ -26,7 +26,7 @@ class StringCoreExtTest &lt; Test::Unit::TestCase
26 26  
27 27 # tests for String#transliterate
28 28 should 'transliterate' do
29   - assert_equal 'eeeeEEOOoocaaaiIIiuuyYnN', 'éèëêÊËÖÔöôçäàâîÏÎïûüÿŸñÑ'.transliterate
  29 + assert_equal 'aaaaaaAAAAAeeeeEEOOoocaaaiIIiuuyYnNcC', 'ªáàäâåÁÀÄÂÅéèëêÊËÖÔöôçäàâîÏÎïûüÿŸñÑçÇ'.transliterate
30 30 end
31 31  
32 32 end
... ...