Skip to content
Browse files

Initial commit

  • Loading branch information...
0 parents commit 7d319f151f70f4fb6beba9a1795c24b982efba86 @davec committed
Showing with 1,890 additions and 0 deletions.
  1. +20 −0 MIT-LICENSE
  2. +37 −0 README.rdoc
  3. +24 −0 Rakefile
  4. +5 −0 init.rb
  5. +4 −0 install.rb
  6. +98 −0 lib/localized_language_select.rb
  7. +510 −0 locale/en.rb
  8. +509 −0 locale/fr.rb
  9. +509 −0 locale/nl.rb
  10. +87 −0 tasks/localized_language_select_tasks.rake
  11. +86 −0 test/localized_language_select_test.rb
  12. +1 −0 uninstall.rb
20 MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2008 [name of plugin creator]
+
+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:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 README.rdoc
@@ -0,0 +1,37 @@
+= LocalizedLanguageSelect
+
+Rails plugin to provide support for localized <tt><select></tt> menu with language names and for
+storing language information as language _code_ (eg. 'sv'), not _name_ (eg. 'Swedish'), in the database.
+
+Uses the Rails internationalization framework (I18n, http://rails-i18n.org) for translating the names of languages.
+Requires Rails 2.2 (released November 21st, 2008) or later versions.
+Language names are loaded from hashes in plugin directory, according to <tt>I18n.locale</tt> value.
+
+You can easily translate language codes in your application like this:
+
+ <%= I18n.t @user.language, :scope => 'languages' %>
+
+Comes with a Rake task <tt>rake import:language_select 'de'</tt> for importing language names
+from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html)
+Don't forget to restart the application when you add new locale.
+
+The code borrows heavily from the LocalizedCountrySelect plugin.
+See http://github.com/karmi/localized_country_select
+
+== Example
+
+ <%= localized_language_select(:user, :language, [], :include_blank => 'Please choose...') %>
+
+will become:
+
+ <select name="user[language]" id="user_language">
+ <option value="">Please choose...</option>
+ <option disabled="disabled" value="">-------------</option>
+ <option value="aa">Afar</option>
+ ...
+ <option value="zza">ZaZa</option>
+ </select>
+
+for the <tt>en</tt> locale.
+
+Copyright (c) 2009 David Cato, released under the MIT license
24 Rakefile
@@ -0,0 +1,24 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+load File.join(File.dirname(__FILE__), 'tasks', 'localized_language_select_tasks.rake')
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the localized_language_select plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the localized_language_select plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'LocalizedLanguageSelect'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README.rdoc')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
5 init.rb
@@ -0,0 +1,5 @@
+# Require the plugin code
+require 'localized_language_select'
+
+# Load locales for languages from +locale+ directory into Rails
+I18n.load_path += Dir[ File.join(File.dirname(__FILE__), 'locale', '*.{rb,yml}') ]
4 install.rb
@@ -0,0 +1,4 @@
+# Show the README text file
+puts "\n\n"
+puts IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+puts "\n"
98 lib/localized_language_select.rb
@@ -0,0 +1,98 @@
+# = LocalizedLanguageSelect
+#
+# View helper for displaying select list with languages:
+#
+# localized_language_select(:user, :language)
+#
+# Works just like the default Rails' +country_select+ plugin, but stores languages as
+# language *codes*, not *names*, in the database.
+#
+# You can easily translate language codes in your application like this:
+# <%= I18n.t @user.language, :scope => 'languages' %>
+#
+# Uses the Rails internationalization framework (I18n) for translating the names of languages.
+#
+# Use Rake task <tt>rake import:language_select 'de'</tt> for importing language names
+# from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html)
+#
+# The code borrows heavily from the LocalizedCountrySelect plugin.
+# See http://github.com/karmi/localized_country_select
+#
+module LocalizedLanguageSelect
+ class << self
+ # Returns array with codes and localized language names (according to <tt>I18n.locale</tt>)
+ # for <tt><option></tt> tags
+ def localized_languages_array
+ I18n.translate(:languages).map { |key, value| [value, key.to_s.downcase] }.sort
+ end
+ # Return array with codes and localized language names for array of language codes passed as argument
+ # == Example
+ # priority_languages_array([:de, :fr, :en])
+ # # => [ ['German', 'de'], ['French', 'fr'], ['English', 'en'] ]
+ def priority_languages_array(language_codes=[])
+ languages = I18n.translate(:languages)
+ language_codes.map { |code| [languages[code], code.to_s.downcase] }
+ end
+ end
+end
+
+module ActionView
+ module Helpers
+
+ module FormOptionsHelper
+
+ # Return select and option tags for the given object and method, using +localized_language_options_for_select+
+ # to generate the list of option tags. Uses <b>language code</b>, not name as option +value+.
+ # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first
+ # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines
+ def localized_language_select(object, method, priority_languages = nil, options = {}, html_options = {})
+ InstanceTag.new(object, method, self, options.delete(:object)).
+ to_localized_language_select_tag(priority_languages, options, html_options)
+ end
+
+ # Return "named" select and option tags according to given arguments.
+ # Use +selected_value+ for setting initial value
+ # It behaves likes older object-binded brother +localized_language_select+ otherwise
+ # TODO : Implement pseudo-named args with a hash, not the "somebody said PHP?" multiple args sillines
+ def localized_language_select_tag(name, selected_value = nil, priority_languages = nil, html_options = {})
+ content_tag :select,
+ localized_language_options_for_select(selected_value, priority_languages),
+ { "name" => name, "id" => name }.update(html_options.stringify_keys)
+ end
+
+ # Returns a string of option tags for languages according to locale. Supply the language code in lower-case ('en', 'de')
+ # as +selected+ to have it marked as the selected option tag.
+ # Language codes listed as an array of symbols in +priority_languages+ argument will be listed first
+ def localized_language_options_for_select(selected = nil, priority_languages = nil)
+ language_options = ""
+ if priority_languages
+ language_options += options_for_select(LocalizedLanguageSelect::priority_languages_array(priority_languages), selected)
+ language_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
+ end
+ return language_options + options_for_select(LocalizedLanguageSelect::localized_languages_array, selected)
+ end
+
+ end
+
+ class InstanceTag
+ def to_localized_language_select_tag(priority_languages, options, html_options)
+ html_options = html_options.stringify_keys
+ add_default_name_and_id(html_options)
+ value = value(object)
+ content_tag("select",
+ add_options(
+ localized_language_options_for_select(value, priority_languages),
+ options, value
+ ), html_options
+ )
+ end
+ end
+
+ class FormBuilder
+ def localized_language_select(method, priority_languages = nil, options = {}, html_options = {})
+ @template.localized_language_select(@object_name, method, priority_languages, options.merge(:object => @object), html_options)
+ end
+ end
+
+ end
+end
510 locale/en.rb
@@ -0,0 +1,510 @@
+{
+ :en => {
+ :languages => {
+ :ab => "Abkhazian",
+ :ace => "Achinese",
+ :ach => "Acoli",
+ :ada => "Adangme",
+ :ady => "Adyghe",
+ :ae => "Avestan",
+ :af => "Afrikaans",
+ :afa => "Afro-Asiatic Language",
+ :afh => "Afrihili",
+ :ain => "Ainu",
+ :ak => "Akan",
+ :akk => "Akkadian",
+ :ale => "Aleut",
+ :alg => "Algonquian Language",
+ :alt => "Southern Altai",
+ :am => "Amharic",
+ :an => "Aragonese",
+ :ang => "Old English",
+ :anp => "Angika",
+ :apa => "Apache Language",
+ :ar => "Arabic",
+ :arc => "Aramaic",
+ :arn => "Araucanian",
+ :arp => "Arapaho",
+ :art => "Artificial Language",
+ :arw => "Arawak",
+ :as => "Assamese",
+ :ast => "Asturian",
+ :ath => "Athapascan Language",
+ :aus => "Australian Language",
+ :av => "Avaric",
+ :awa => "Awadhi",
+ :ay => "Aymara",
+ :az => "Azerbaijani",
+ :ba => "Bashkir",
+ :bad => "Banda",
+ :bai => "Bamileke Language",
+ :bal => "Baluchi",
+ :ban => "Balinese",
+ :bas => "Basa",
+ :bat => "Baltic Language",
+ :be => "Belarusian",
+ :bej => "Beja",
+ :bem => "Bemba",
+ :ber => "Berber",
+ :bg => "Bulgarian",
+ :bh => "Bihari",
+ :bho => "Bhojpuri",
+ :bi => "Bislama",
+ :bik => "Bikol",
+ :bin => "Bini",
+ :bla => "Siksika",
+ :bm => "Bambara",
+ :bn => "Bengali",
+ :bnt => "Bantu",
+ :bo => "Tibetan",
+ :br => "Breton",
+ :bra => "Braj",
+ :bs => "Bosnian",
+ :btk => "Batak",
+ :bua => "Buriat",
+ :bug => "Buginese",
+ :byn => "Blin",
+ :ca => "Catalan",
+ :cad => "Caddo",
+ :cai => "Central American Indian Language",
+ :car => "Carib",
+ :cau => "Caucasian Language",
+ :cch => "Atsam",
+ :ce => "Chechen",
+ :ceb => "Cebuano",
+ :cel => "Celtic Language",
+ :ch => "Chamorro",
+ :chb => "Chibcha",
+ :chg => "Chagatai",
+ :chk => "Chuukese",
+ :chm => "Mari",
+ :chn => "Chinook Jargon",
+ :cho => "Choctaw",
+ :chp => "Chipewyan",
+ :chr => "Cherokee",
+ :chy => "Cheyenne",
+ :cmc => "Chamic Language",
+ :co => "Corsican",
+ :cop => "Coptic",
+ :cpe => "English-based Creole or Pidgin",
+ :cpf => "French-based Creole or Pidgin",
+ :cpp => "Portuguese-based Creole or Pidgin",
+ :cr => "Cree",
+ :crh => "Crimean Turkish",
+ :crp => "Creole or Pidgin",
+ :cs => "Czech",
+ :csb => "Kashubian",
+ :cu => "Church Slavic",
+ :cus => "Cushitic Language",
+ :cv => "Chuvash",
+ :cy => "Welsh",
+ :da => "Danish",
+ :dak => "Dakota",
+ :dar => "Dargwa",
+ :day => "Dayak",
+ :de => "German",
+ :"de-AT" => "Austrian German",
+ :"de-CH" => "Swiss High German",
+ :del => "Delaware",
+ :den => "Slave",
+ :dgr => "Dogrib",
+ :din => "Dinka",
+ :doi => "Dogri",
+ :dra => "Dravidian Language",
+ :dsb => "Lower Sorbian",
+ :dua => "Duala",
+ :dum => "Middle Dutch",
+ :dv => "Divehi",
+ :dyu => "Dyula",
+ :dz => "Dzongkha",
+ :ee => "Ewe",
+ :efi => "Efik",
+ :egy => "Ancient Egyptian",
+ :eka => "Ekajuk",
+ :el => "Greek",
+ :elx => "Elamite",
+ :en => "English",
+ :"en-AU" => "Australian English",
+ :"en-CA" => "Canadian English",
+ :"en-GB" => "British English",
+ :"en-US" => "U.S. English",
+ :enm => "Middle English",
+ :eo => "Esperanto",
+ :es => "Spanish",
+ :"es-ES" => "Iberian Spanish",
+ :et => "Estonian",
+ :eu => "Basque",
+ :ewo => "Ewondo",
+ :fa => "Persian",
+ :fan => "Fang",
+ :fat => "Fanti",
+ :ff => "Fulah",
+ :fi => "Finnish",
+ :fil => "Filipino",
+ :fiu => "Finno-Ugrian Language",
+ :fj => "Fijian",
+ :fo => "Faroese",
+ :fon => "Fon",
+ :fr => "French",
+ :"fr-CA" => "Canadian French",
+ :"fr-CH" => "Swiss French",
+ :frm => "Middle French",
+ :fro => "Old French",
+ :frr => "Northern Frisian",
+ :frs => "Eastern Frisian",
+ :fur => "Friulian",
+ :fy => "Western Frisian",
+ :ga => "Irish",
+ :gaa => "Ga",
+ :gay => "Gayo",
+ :gba => "Gbaya",
+ :gd => "Scottish Gaelic",
+ :gem => "Germanic Language",
+ :gez => "Geez",
+ :gil => "Gilbertese",
+ :gl => "Galician",
+ :gmh => "Middle High German",
+ :gn => "Guarani",
+ :goh => "Old High German",
+ :gon => "Gondi",
+ :gor => "Gorontalo",
+ :got => "Gothic",
+ :grb => "Grebo",
+ :grc => "Ancient Greek",
+ :gsw => "Swiss German",
+ :gu => "Gujarati",
+ :gv => "Manx",
+ :gwi => "Gwichʼin",
+ :ha => "Hausa",
+ :hai => "Haida",
+ :haw => "Hawaiian",
+ :he => "Hebrew",
+ :hi => "Hindi",
+ :hil => "Hiligaynon",
+ :him => "Himachali",
+ :hit => "Hittite",
+ :hmn => "Hmong",
+ :ho => "Hiri Motu",
+ :hr => "Croatian",
+ :hsb => "Upper Sorbian",
+ :ht => "Haitian",
+ :hu => "Hungarian",
+ :hup => "Hupa",
+ :hy => "Armenian",
+ :hz => "Herero",
+ :ia => "Interlingua",
+ :iba => "Iban",
+ :id => "Indonesian",
+ :ie => "Interlingue",
+ :ig => "Igbo",
+ :ii => "Sichuan Yi",
+ :ijo => "Ijo",
+ :ik => "Inupiaq",
+ :ilo => "Iloko",
+ :inc => "Indic Language",
+ :ine => "Indo-European Language",
+ :inh => "Ingush",
+ :io => "Ido",
+ :ira => "Iranian Language",
+ :iro => "Iroquoian Language",
+ :is => "Icelandic",
+ :it => "Italian",
+ :iu => "Inuktitut",
+ :ja => "Japanese",
+ :jbo => "Lojban",
+ :jpr => "Judeo-Persian",
+ :jrb => "Judeo-Arabic",
+ :jv => "Javanese",
+ :ka => "Georgian",
+ :kaa => "Kara-Kalpak",
+ :kab => "Kabyle",
+ :kac => "Kachin",
+ :kaj => "Jju",
+ :kam => "Kamba",
+ :kar => "Karen",
+ :kaw => "Kawi",
+ :kbd => "Kabardian",
+ :kcg => "Tyap",
+ :kfo => "Koro",
+ :kg => "Kongo",
+ :kha => "Khasi",
+ :khi => "Khoisan Language",
+ :kho => "Khotanese",
+ :ki => "Kikuyu",
+ :kj => "Kuanyama",
+ :kk => "Kazakh",
+ :kl => "Kalaallisut",
+ :km => "Khmer",
+ :kmb => "Kimbundu",
+ :kn => "Kannada",
+ :ko => "Korean",
+ :kok => "Konkani",
+ :kos => "Kosraean",
+ :kpe => "Kpelle",
+ :kr => "Kanuri",
+ :krc => "Karachay-Balkar",
+ :krl => "Karelian",
+ :kro => "Kru",
+ :kru => "Kurukh",
+ :ks => "Kashmiri",
+ :ku => "Kurdish",
+ :kum => "Kumyk",
+ :kut => "Kutenai",
+ :kv => "Komi",
+ :kw => "Cornish",
+ :ky => "Kirghiz",
+ :la => "Latin",
+ :lad => "Ladino",
+ :lah => "Lahnda",
+ :lam => "Lamba",
+ :lb => "Luxembourgish",
+ :lez => "Lezghian",
+ :lg => "Ganda",
+ :li => "Limburgish",
+ :ln => "Lingala",
+ :lo => "Lao",
+ :lol => "Mongo",
+ :loz => "Lozi",
+ :lt => "Lithuanian",
+ :lu => "Luba-Katanga",
+ :lua => "Luba-Lulua",
+ :lui => "Luiseno",
+ :lun => "Lunda",
+ :luo => "Luo",
+ :lus => "Lushai",
+ :lv => "Latvian",
+ :mad => "Madurese",
+ :mag => "Magahi",
+ :mai => "Maithili",
+ :mak => "Makasar",
+ :man => "Mandingo",
+ :map => "Austronesian Language",
+ :mas => "Masai",
+ :mdf => "Moksha",
+ :mdr => "Mandar",
+ :men => "Mende",
+ :mg => "Malagasy",
+ :mga => "Middle Irish",
+ :mh => "Marshallese",
+ :mi => "Maori",
+ :mic => "Micmac",
+ :min => "Minangkabau",
+ :mis => "Miscellaneous Language",
+ :mk => "Macedonian",
+ :mkh => "Mon-Khmer Language",
+ :ml => "Malayalam",
+ :mn => "Mongolian",
+ :mnc => "Manchu",
+ :mni => "Manipuri",
+ :mno => "Manobo Language",
+ :mo => "Moldavian",
+ :moh => "Mohawk",
+ :mos => "Mossi",
+ :mr => "Marathi",
+ :ms => "Malay",
+ :mt => "Maltese",
+ :mul => "Multiple Languages",
+ :mun => "Munda Language",
+ :mus => "Creek",
+ :mwl => "Mirandese",
+ :mwr => "Marwari",
+ :my => "Burmese",
+ :myn => "Mayan Language",
+ :myv => "Erzya",
+ :na => "Nauru",
+ :nah => "Nahuatl",
+ :nai => "North American Indian Language",
+ :nap => "Neapolitan",
+ :nb => "Norwegian Bokmål",
+ :nd => "North Ndebele",
+ :nds => "Low German",
+ :ne => "Nepali",
+ :new => "Newari",
+ :ng => "Ndonga",
+ :nia => "Nias",
+ :nic => "Niger-Kordofanian Language",
+ :niu => "Niuean",
+ :nl => "Dutch",
+ :"nl-BE" => "Flemish",
+ :nn => "Norwegian Nynorsk",
+ :no => "Norwegian",
+ :nog => "Nogai",
+ :non => "Old Norse",
+ :nqo => "N’Ko",
+ :nr => "South Ndebele",
+ :nso => "Northern Sotho",
+ :nub => "Nubian Language",
+ :nv => "Navajo",
+ :nwc => "Classical Newari",
+ :ny => "Nyanja",
+ :nym => "Nyamwezi",
+ :nyn => "Nyankole",
+ :nyo => "Nyoro",
+ :nzi => "Nzima",
+ :oc => "Occitan",
+ :oj => "Ojibwa",
+ :om => "Oromo",
+ :or => "Oriya",
+ :os => "Ossetic",
+ :osa => "Osage",
+ :ota => "Ottoman Turkish",
+ :oto => "Otomian Language",
+ :pa => "Punjabi",
+ :paa => "Papuan Language",
+ :pag => "Pangasinan",
+ :pal => "Pahlavi",
+ :pam => "Pampanga",
+ :pap => "Papiamento",
+ :pau => "Palauan",
+ :peo => "Old Persian",
+ :phi => "Philippine Language",
+ :phn => "Phoenician",
+ :pi => "Pali",
+ :pl => "Polish",
+ :pon => "Pohnpeian",
+ :pra => "Prakrit Language",
+ :pro => "Old Provençal",
+ :ps => "Pashto",
+ :pt => "Portuguese",
+ :"pt-BR" => "Brazilian Portuguese",
+ :"pt-PT" => "Iberian Portuguese",
+ :qu => "Quechua",
+ :raj => "Rajasthani",
+ :rap => "Rapanui",
+ :rar => "Rarotongan",
+ :rm => "Rhaeto-Romance",
+ :rn => "Rundi",
+ :ro => "Romanian",
+ :roa => "Romance Language",
+ :rom => "Romany",
+ :ru => "Russian",
+ :rup => "Aromanian",
+ :rw => "Kinyarwanda",
+ :sa => "Sanskrit",
+ :sad => "Sandawe",
+ :sah => "Yakut",
+ :sai => "South American Indian Language",
+ :sal => "Salishan Language",
+ :sam => "Samaritan Aramaic",
+ :sas => "Sasak",
+ :sat => "Santali",
+ :sc => "Sardinian",
+ :scn => "Sicilian",
+ :sco => "Scots",
+ :sd => "Sindhi",
+ :se => "Northern Sami",
+ :sel => "Selkup",
+ :sem => "Semitic Language",
+ :sg => "Sango",
+ :sga => "Old Irish",
+ :sgn => "Sign Language",
+ :sh => "Serbo-Croatian",
+ :shn => "Shan",
+ :si => "Sinhala",
+ :sid => "Sidamo",
+ :sio => "Siouan Language",
+ :sit => "Sino-Tibetan Language",
+ :sk => "Slovak",
+ :sl => "Slovenian",
+ :sla => "Slavic Language",
+ :sm => "Samoan",
+ :sma => "Southern Sami",
+ :smi => "Sami Language",
+ :smj => "Lule Sami",
+ :smn => "Inari Sami",
+ :sms => "Skolt Sami",
+ :sn => "Shona",
+ :snk => "Soninke",
+ :so => "Somali",
+ :sog => "Sogdien",
+ :son => "Songhai",
+ :sq => "Albanian",
+ :sr => "Serbian",
+ :srn => "Sranan Tongo",
+ :srr => "Serer",
+ :ss => "Swati",
+ :ssa => "Nilo-Saharan Language",
+ :st => "Southern Sotho",
+ :su => "Sundanese",
+ :suk => "Sukuma",
+ :sus => "Susu",
+ :sux => "Sumerian",
+ :sv => "Swedish",
+ :sw => "Swahili",
+ :syc => "Classical Syriac",
+ :syr => "Syriac",
+ :ta => "Tamil",
+ :tai => "Tai Language",
+ :te => "Telugu",
+ :tem => "Timne",
+ :ter => "Tereno",
+ :tet => "Tetum",
+ :tg => "Tajik",
+ :th => "Thai",
+ :ti => "Tigrinya",
+ :tig => "Tigre",
+ :tiv => "Tiv",
+ :tk => "Turkmen",
+ :tkl => "Tokelau",
+ :tl => "Tagalog",
+ :tlh => "Klingon",
+ :tli => "Tlingit",
+ :tmh => "Tamashek",
+ :tn => "Tswana",
+ :to => "Tonga",
+ :tog => "Nyasa Tonga",
+ :tpi => "Tok Pisin",
+ :tr => "Turkish",
+ :trv => "Taroko",
+ :ts => "Tsonga",
+ :tsi => "Tsimshian",
+ :tt => "Tatar",
+ :tum => "Tumbuka",
+ :tup => "Tupi Language",
+ :tut => "Altaic Language",
+ :tvl => "Tuvalu",
+ :tw => "Twi",
+ :ty => "Tahitian",
+ :tyv => "Tuvinian",
+ :udm => "Udmurt",
+ :ug => "Uighur",
+ :uga => "Ugaritic",
+ :uk => "Ukrainian",
+ :umb => "Umbundu",
+ :und => "Unknown or Invalid Language",
+ :ur => "Urdu",
+ :uz => "Uzbek",
+ :vai => "Vai",
+ :ve => "Venda",
+ :vi => "Vietnamese",
+ :vo => "Volapük",
+ :vot => "Votic",
+ :wa => "Walloon",
+ :wak => "Wakashan Language",
+ :wal => "Walamo",
+ :war => "Waray",
+ :was => "Washo",
+ :wen => "Sorbian Language",
+ :wo => "Wolof",
+ :xal => "Kalmyk",
+ :xh => "Xhosa",
+ :yao => "Yao",
+ :yap => "Yapese",
+ :yi => "Yiddish",
+ :yo => "Yoruba",
+ :ypk => "Yupik Language",
+ :za => "Zhuang",
+ :zap => "Zapotec",
+ :zbl => "Blissymbols",
+ :zen => "Zenaga",
+ :zh => "Chinese",
+ :"zh-Hans" => "Simplified Chinese",
+ :"zh-Hant" => "Traditional Chinese",
+ :znd => "Zande",
+ :zu => "Zulu",
+ :zun => "Zuni",
+ :zxx => "No linguistic content",
+ :zza => "Zaza",
+ }
+ }
+}
509 locale/fr.rb
@@ -0,0 +1,509 @@
+{
+ :fr => {
+ :languages => {
+ :ab => "abkhaze",
+ :ace => "aceh",
+ :ach => "acoli",
+ :ada => "adangme",
+ :ady => "adyghéen",
+ :ae => "avestique",
+ :af => "afrikaans",
+ :afa => "langue afro-asiatique",
+ :afh => "afrihili",
+ :ain => "aïnou",
+ :ak => "akan",
+ :akk => "akkadien",
+ :ale => "aléoute",
+ :alg => "langue algonquienne",
+ :alt => "altaï du Sud",
+ :am => "amharique",
+ :an => "aragonais",
+ :ang => "ancien anglais",
+ :anp => "angika",
+ :apa => "langue apache",
+ :ar => "arabe",
+ :arc => "araméen",
+ :arn => "araukan",
+ :arp => "arapaho",
+ :art => "langue artificielle",
+ :arw => "arawak",
+ :as => "assamais",
+ :ast => "asturien",
+ :ath => "langue athapascane",
+ :aus => "langue australienne",
+ :av => "avar",
+ :awa => "awadhi",
+ :ay => "aymara",
+ :az => "azéri",
+ :ba => "bachkir",
+ :bad => "banda",
+ :bai => "langue bamilékée",
+ :bal => "baloutchi",
+ :ban => "balinais",
+ :bas => "bassa",
+ :bat => "langue balte",
+ :be => "biélorusse",
+ :bej => "bedja",
+ :bem => "bemba",
+ :ber => "berbère",
+ :bg => "bulgare",
+ :bh => "bihari",
+ :bho => "bhojpuri",
+ :bi => "bichelamar",
+ :bik => "bikol",
+ :bin => "bini",
+ :bla => "siksika",
+ :bm => "bambara",
+ :bn => "bengali",
+ :bnt => "bantou",
+ :bo => "tibétain",
+ :br => "breton",
+ :bra => "braj",
+ :bs => "bosniaque",
+ :btk => "batak",
+ :bua => "bouriate",
+ :bug => "bugi",
+ :byn => "blin",
+ :ca => "catalan",
+ :cad => "caddo",
+ :cai => "langue amérindienne centrale",
+ :car => "caribe",
+ :cau => "langue caucasienne",
+ :cch => "atsam",
+ :ce => "tchétchène",
+ :ceb => "cebuano",
+ :cel => "langue celtique",
+ :ch => "chamorro",
+ :chb => "chibcha",
+ :chg => "tchaghataï",
+ :chk => "chuuk",
+ :chm => "mari",
+ :chn => "jargon chinook",
+ :cho => "choctaw",
+ :chp => "chipewyan",
+ :chr => "cherokee",
+ :chy => "cheyenne",
+ :cmc => "langue chame",
+ :co => "corse",
+ :cop => "copte",
+ :cpe => "créole ou pidgin anglais",
+ :cpf => "créole ou pidgin français",
+ :cpp => "créole ou pidgin portugais",
+ :cr => "cree",
+ :crh => "turc de Crimée",
+ :crp => "créole ou pidgin",
+ :cs => "tchèque",
+ :csb => "kachoube",
+ :cu => "slavon d’église",
+ :cus => "langue couchitique",
+ :cv => "tchouvache",
+ :cy => "gallois",
+ :da => "danois",
+ :dak => "dakota",
+ :dar => "dargwa",
+ :day => "dayak",
+ :de => "allemand",
+ :"de-AT" => "allemand autrichien",
+ :"de-CH" => "allemand suisse",
+ :del => "delaware",
+ :den => "slavey",
+ :dgr => "dogrib",
+ :din => "dinka",
+ :doi => "dogri",
+ :dra => "langue dravidienne",
+ :dsb => "bas-sorabe",
+ :dua => "douala",
+ :dum => "moyen néerlandais",
+ :dv => "maldivien",
+ :dyu => "dioula",
+ :dz => "dzongkha",
+ :ee => "éwé",
+ :efi => "efik",
+ :egy => "égyptien ancien",
+ :eka => "ekajuk",
+ :el => "grec",
+ :elx => "élamite",
+ :en => "anglais",
+ :"en-AU" => "anglais australien",
+ :"en-CA" => "anglais canadien",
+ :"en-GB" => "anglais britannique",
+ :"en-US" => "anglais américain",
+ :enm => "moyen anglais",
+ :eo => "espéranto",
+ :es => "espagnol",
+ :"es-ES" => "espagnol ibérique",
+ :et => "estonien",
+ :eu => "basque",
+ :ewo => "éwondo",
+ :fa => "persan",
+ :fan => "fang",
+ :fat => "fanti",
+ :ff => "peul",
+ :fi => "finnois",
+ :fil => "filipino",
+ :fiu => "langue finno-ougrienne",
+ :fj => "fidjien",
+ :fo => "féroïen",
+ :fon => "fon",
+ :fr => "français",
+ :"fr-CA" => "français canadien",
+ :"fr-CH" => "français suisse",
+ :frm => "moyen français",
+ :fro => "ancien français",
+ :frr => "frison du Nord",
+ :frs => "frison oriental",
+ :fur => "frioulan",
+ :fy => "frison",
+ :ga => "irlandais",
+ :gaa => "ga",
+ :gay => "gayo",
+ :gba => "gbaya",
+ :gd => "gaélique écossais",
+ :gem => "langue germanique",
+ :gez => "guèze",
+ :gil => "gilbertais",
+ :gl => "galicien",
+ :gmh => "moyen haut-allemand",
+ :gn => "guarani",
+ :goh => "ancien haut allemand",
+ :gon => "gondi",
+ :gor => "gorontalo",
+ :got => "gotique",
+ :grb => "grebo",
+ :grc => "grec ancien",
+ :gsw => "alémanique",
+ :gu => "goudjarâtî",
+ :gv => "manx",
+ :gwi => "gwichʼin",
+ :ha => "haoussa",
+ :hai => "haida",
+ :haw => "hawaïen",
+ :he => "hébreu",
+ :hi => "hindi",
+ :hil => "hiligaynon",
+ :him => "himachali",
+ :hit => "hittite",
+ :hmn => "hmong",
+ :ho => "hiri motu",
+ :hr => "croate",
+ :hsb => "haut-sorabe",
+ :ht => "haïtien",
+ :hu => "hongrois",
+ :hup => "hupa",
+ :hy => "arménien",
+ :hz => "héréro",
+ :ia => "interlingua",
+ :iba => "iban",
+ :id => "indonésien",
+ :ie => "interlingue",
+ :ig => "igbo",
+ :ii => "yi de Sichuan",
+ :ijo => "ijo",
+ :ik => "inupiaq",
+ :ilo => "ilokano",
+ :inc => "langue indo-aryenne",
+ :ine => "langue indo-européenne",
+ :inh => "ingouche",
+ :io => "ido",
+ :ira => "langue iranienne",
+ :iro => "langue iroquoienne",
+ :is => "islandais",
+ :it => "italien",
+ :iu => "inuktitut",
+ :ja => "japonais",
+ :jbo => "lojban",
+ :jpr => "judéo-persan",
+ :jrb => "judéo-arabe",
+ :jv => "javanais",
+ :ka => "géorgien",
+ :kaa => "karakalpak",
+ :kab => "kabyle",
+ :kac => "kachin",
+ :kaj => "jju",
+ :kam => "kamba",
+ :kar => "karen",
+ :kaw => "kawi",
+ :kbd => "kabardin",
+ :kcg => "tyap",
+ :kfo => "koro",
+ :kg => "kongo",
+ :kha => "khasi",
+ :khi => "langue khoïsan",
+ :kho => "khotanais",
+ :ki => "kikuyu",
+ :kj => "kuanyama",
+ :kk => "kazakh",
+ :kl => "groenlandais",
+ :km => "khmer",
+ :kmb => "kiMboundou",
+ :kn => "kannada",
+ :ko => "coréen",
+ :kok => "konkani",
+ :kos => "kusaien",
+ :kpe => "kpellé",
+ :kr => "kanouri",
+ :krc => "karatchaï balkar",
+ :krl => "carélien",
+ :kro => "krou",
+ :kru => "kurukh",
+ :ks => "kâshmîrî",
+ :ku => "kurde",
+ :kum => "koumyk",
+ :kut => "kutenai",
+ :kv => "komi",
+ :kw => "cornique",
+ :ky => "kirghize",
+ :la => "latin",
+ :lad => "ladino",
+ :lah => "lahnda",
+ :lam => "lamba",
+ :lb => "luxembourgeois",
+ :lez => "lezghien",
+ :lg => "ganda",
+ :li => "limbourgeois",
+ :ln => "lingala",
+ :lo => "lao",
+ :lol => "mongo",
+ :loz => "lozi",
+ :lt => "lituanien",
+ :lu => "luba-katanga",
+ :lua => "luba-lulua",
+ :lui => "luiseno",
+ :lun => "lunda",
+ :luo => "luo",
+ :lus => "lushai",
+ :lv => "letton",
+ :mad => "madurais",
+ :mag => "magahi",
+ :mai => "maithili",
+ :mak => "makassar",
+ :man => "mandingue",
+ :map => "malayo-polynésien",
+ :mas => "masai",
+ :mdf => "moksa",
+ :mdr => "mandar",
+ :men => "mendé",
+ :mg => "malgache",
+ :mga => "moyen irlandais",
+ :mh => "marshall",
+ :mi => "maori",
+ :mic => "micmac",
+ :min => "minangkabau",
+ :mis => "langue diverse",
+ :mk => "macédonien",
+ :mkh => "langue mon-khmère",
+ :ml => "malayalam",
+ :mn => "mongol",
+ :mnc => "mandchou",
+ :mni => "manipuri",
+ :mno => "langue manobo",
+ :mo => "moldave",
+ :moh => "mohawk",
+ :mos => "moré",
+ :mr => "marathe",
+ :ms => "malais",
+ :mt => "maltais",
+ :mul => "multilingue",
+ :mun => "langue mounda",
+ :mus => "creek",
+ :mwl => "mirandais",
+ :mwr => "marwarî",
+ :my => "birman",
+ :myn => "langue maya",
+ :myv => "erzya",
+ :na => "nauruan",
+ :nah => "nahuatl",
+ :nai => "langue amérindienne du Nord",
+ :nap => "napolitain",
+ :nb => "norvégien bokmål",
+ :nd => "ndébélé du Nord",
+ :nds => "bas-allemand",
+ :ne => "népalais",
+ :new => "newari",
+ :ng => "ndonga",
+ :nia => "nias",
+ :nic => "langue nigéro-congolaise",
+ :niu => "niué",
+ :nl => "néerlandais",
+ :"nl-BE" => "néerlandais belge",
+ :nn => "norvégien nynorsk",
+ :no => "norvégien",
+ :nog => "nogaï",
+ :non => "vieux norrois",
+ :nqo => "n’ko",
+ :nr => "ndébélé du Sud",
+ :nso => "sotho du Nord",
+ :nub => "langue nubienne",
+ :nv => "navaho",
+ :nwc => "newarî classique",
+ :ny => "nyanja",
+ :nym => "nyamwezi",
+ :nyn => "nyankolé",
+ :nyo => "nyoro",
+ :nzi => "nzema",
+ :oc => "occitan",
+ :oj => "ojibwa",
+ :om => "oromo",
+ :or => "oriya",
+ :os => "ossète",
+ :osa => "osage",
+ :ota => "turc ottoman",
+ :oto => "langue otomangue",
+ :pa => "pendjabi",
+ :paa => "langue papoue",
+ :pag => "pangasinan",
+ :pal => "pahlavi",
+ :pam => "pampangan",
+ :pap => "papiamento",
+ :pau => "palau",
+ :peo => "persan ancien",
+ :phi => "langue philippine",
+ :phn => "phénicien",
+ :pi => "pali",
+ :pl => "polonais",
+ :pon => "pohnpei",
+ :pra => "langues prâkrit",
+ :pro => "provençal ancien",
+ :ps => "pachto",
+ :pt => "portugais",
+ :"pt-BR" => "portugais brésilien",
+ :"pt-PT" => "portugais ibérique",
+ :qu => "langue quechua",
+ :raj => "rajasthani",
+ :rap => "rapanui",
+ :rar => "rarotongien",
+ :rm => "rhéto-roman",
+ :rn => "roundi",
+ :ro => "roumain",
+ :roa => "langue romane",
+ :rom => "tzigane",
+ :ru => "russe",
+ :rup => "valaque",
+ :rw => "rwanda",
+ :sa => "sanskrit",
+ :sad => "sandawe",
+ :sah => "iakoute",
+ :sai => "langue amérindienne du Sud",
+ :sal => "langue salishenne",
+ :sam => "araméen samaritain",
+ :sas => "sasak",
+ :sat => "santal",
+ :sc => "sarde",
+ :scn => "sicilien",
+ :sco => "écossais",
+ :sd => "sindhî",
+ :se => "sami du Nord",
+ :sel => "selkoupe",
+ :sem => "langue sémitique",
+ :sg => "sangho",
+ :sga => "ancien irlandais",
+ :sgn => "langue des signes",
+ :sh => "serbo-croate",
+ :shn => "shan",
+ :si => "singhalais",
+ :sid => "sidamo",
+ :sio => "langue sioux",
+ :sit => "langue sino-tibétaine",
+ :sk => "slovaque",
+ :sl => "slovène",
+ :sla => "langue slave",
+ :sm => "samoan",
+ :sma => "sami du Sud",
+ :smi => "langue samie",
+ :smj => "sami de Lule",
+ :smn => "sami d’Inari",
+ :sms => "sami skolt",
+ :sn => "shona",
+ :snk => "soninké",
+ :so => "somali",
+ :sog => "sogdien",
+ :son => "songhai",
+ :sq => "albanais",
+ :sr => "serbe",
+ :srn => "sranan tongo",
+ :srr => "sérère",
+ :ss => "swati",
+ :ssa => "langue nilo-saharienne",
+ :st => "sesotho",
+ :su => "soundanais",
+ :suk => "sukuma",
+ :sus => "soussou",
+ :sux => "sumérien",
+ :sv => "suédois",
+ :sw => "swahili",
+ :syc => "syriaque classique",
+ :syr => "syriaque",
+ :ta => "tamoul",
+ :tai => "langue taï",
+ :te => "télougou",
+ :tem => "temne",
+ :ter => "tereno",
+ :tet => "tetum",
+ :tg => "tadjik",
+ :th => "thaï",
+ :ti => "tigrigna",
+ :tig => "tigré",
+ :tiv => "tiv",
+ :tk => "turkmène",
+ :tkl => "tokelau",
+ :tl => "tagalog",
+ :tlh => "klingon",
+ :tli => "tlingit",
+ :tmh => "tamacheq",
+ :tn => "tswana",
+ :to => "tongan",
+ :tog => "tonga nyasa",
+ :tpi => "tok pisin",
+ :tr => "turc",
+ :ts => "tsonga",
+ :tsi => "tsimshian",
+ :tt => "tatar",
+ :tum => "tumbuka",
+ :tup => "langue tupi",
+ :tut => "langue altaïque",
+ :tvl => "tuvalu",
+ :tw => "twi",
+ :ty => "tahitien",
+ :tyv => "touva",
+ :udm => "oudmourte",
+ :ug => "ouïgour",
+ :uga => "ougaritique",
+ :uk => "ukrainien",
+ :umb => "umbundu",
+ :und => "indéterminé",
+ :ur => "ourdou",
+ :uz => "ouzbek",
+ :vai => "vaï",
+ :ve => "venda",
+ :vi => "vietnamien",
+ :vo => "volapuk",
+ :vot => "vote",
+ :wa => "wallon",
+ :wak => "langues wakashennes",
+ :wal => "walamo",
+ :war => "waray",
+ :was => "washo",
+ :wen => "langue sorabe",
+ :wo => "wolof",
+ :xal => "kalmouk",
+ :xh => "xhosa",
+ :yao => "yao",
+ :yap => "yapois",
+ :yi => "yiddish",
+ :yo => "yoruba",
+ :ypk => "langues yupik",
+ :za => "zhuang",
+ :zap => "zapotèque",
+ :zbl => "symboles Bliss",
+ :zen => "zenaga",
+ :zh => "chinois",
+ :"zh-Hans" => "chinois simplifié",
+ :"zh-Hant" => "chinois traditionnel",
+ :znd => "zandé",
+ :zu => "zoulou",
+ :zun => "zuni",
+ :zxx => "sans contenu linguistique",
+ :zza => "zazaki",
+ }
+ }
+}
509 locale/nl.rb
@@ -0,0 +1,509 @@
+{
+ :nl => {
+ :languages => {
+ :ab => "Abchazisch",
+ :ace => "Atjees",
+ :ach => "Akoli",
+ :ada => "Adangme",
+ :ady => "Adyghe",
+ :ae => "Avestisch",
+ :af => "Afrikaans",
+ :afa => "Afro-Aziatische taal",
+ :afh => "Afrihili",
+ :ain => "Ainu",
+ :ak => "Akan",
+ :akk => "Akkadisch",
+ :ale => "Aleut",
+ :alg => "Algonkium-taal",
+ :alt => "Zuid-Altaïsch",
+ :am => "Amhaars",
+ :an => "Aragonees",
+ :ang => "Oudengels",
+ :anp => "Angika",
+ :apa => "Apache-taal",
+ :ar => "Arabisch",
+ :arc => "Aramees",
+ :arn => "Araukaans",
+ :arp => "Arapaho",
+ :art => "Kunstmatige taal",
+ :arw => "Arawak",
+ :as => "Assamees",
+ :ast => "Asturisch",
+ :ath => "Athapascaanse taal",
+ :aus => "Australische taal",
+ :av => "Avarisch",
+ :awa => "Awadhi",
+ :ay => "Aymara",
+ :az => "Azerbeidzjaans",
+ :ba => "Basjkiers",
+ :bad => "Banda",
+ :bai => "Bamileke-taal",
+ :bal => "Baloetsji",
+ :ban => "Balinees",
+ :bas => "Basa",
+ :bat => "Baltische taal",
+ :be => "Wit-Russisch",
+ :bej => "Beja",
+ :bem => "Bemba",
+ :ber => "Berber",
+ :bg => "Bulgaars",
+ :bh => "Bihari",
+ :bho => "Bhojpuri",
+ :bi => "Bislama",
+ :bik => "Bikol",
+ :bin => "Bini",
+ :bla => "Siksika",
+ :bm => "Bambara",
+ :bn => "Bengalees",
+ :bnt => "Bantoe",
+ :bo => "Tibetaans",
+ :br => "Bretons",
+ :bra => "Braj",
+ :bs => "Bosnisch",
+ :btk => "Batak",
+ :bua => "Buriat",
+ :bug => "Buginees",
+ :byn => "Blin",
+ :ca => "Catalaans",
+ :cad => "Caddo",
+ :cai => "Midden-Amerikaans Indiaanse taal",
+ :car => "Caribisch",
+ :cau => "Kaukasische taal",
+ :cch => "Atsam",
+ :ce => "Chechen",
+ :ceb => "Cebuano",
+ :cel => "Keltische taal",
+ :ch => "Chamorro",
+ :chb => "Chibcha",
+ :chg => "Chagatai",
+ :chk => "Chuukees",
+ :chm => "Mari",
+ :chn => "Chinook-jargon",
+ :cho => "Choctaw",
+ :chp => "Chipewyan",
+ :chr => "Cherokee",
+ :chy => "Cheyenne",
+ :cmc => "Chamische taal",
+ :co => "Corsicaans",
+ :cop => "Koptisch",
+ :cpe => "Op Engels gebaseerd Creools of Pidgin",
+ :cpf => "Op Frans gebaseerd Creools of Pidgin",
+ :cpp => "Op Portugees gebaseerd Creools of Pidgin",
+ :cr => "Cree",
+ :crh => "Krim-Tataars",
+ :crp => "Creools of Pidgin",
+ :cs => "Tsjechisch",
+ :csb => "Kasjoebisch",
+ :cu => "Kerkslavisch",
+ :cus => "Koesjitische taal",
+ :cv => "Tsjoevasjisch",
+ :cy => "Welsh",
+ :da => "Deens",
+ :dak => "Dakota",
+ :dar => "Dargwa",
+ :day => "Dajak",
+ :de => "Duits",
+ :"de-AT" => "Oostenrijks Duits",
+ :"de-CH" => "Zwitsers Hoogduits",
+ :del => "Delaware",
+ :den => "Slave",
+ :dgr => "Dogrib",
+ :din => "Dinka",
+ :doi => "Dogri",
+ :dra => "Dravidische taal",
+ :dsb => "Nedersorbisch",
+ :dua => "Duala",
+ :dum => "Middelnederlands",
+ :dv => "Divehi",
+ :dyu => "Dyula",
+ :dz => "Dzongkha",
+ :ee => "Ewe",
+ :efi => "Efik",
+ :egy => "Oudegyptisch",
+ :eka => "Ekajuk",
+ :el => "Grieks",
+ :elx => "Elamitisch",
+ :en => "Engels",
+ :"en-AU" => "Australisch Engels",
+ :"en-CA" => "Canadees Engels",
+ :"en-GB" => "Brits Engels",
+ :"en-US" => "Amerikaans Engels",
+ :enm => "Middelengels",
+ :eo => "Esperanto",
+ :es => "Spaans",
+ :"es-ES" => "Iberisch Spaans",
+ :et => "Estlands",
+ :eu => "Baskisch",
+ :ewo => "Ewondo",
+ :fa => "Perzisch",
+ :fan => "Fang",
+ :fat => "Fanti",
+ :ff => "Fulah",
+ :fi => "Fins",
+ :fil => "Filippijns",
+ :fiu => "Fins-Oegrische taal",
+ :fj => "Fijisch",
+ :fo => "Faeröers",
+ :fon => "Fon",
+ :fr => "Frans",
+ :"fr-CA" => "Canadees Frans",
+ :"fr-CH" => "Zwitsers Frans",
+ :frm => "Middelfrans",
+ :fro => "Oudfrans",
+ :frr => "Noord-Fries",
+ :frs => "Oost-Fries",
+ :fur => "Friulisch",
+ :fy => "Fries",
+ :ga => "Iers",
+ :gaa => "Ga",
+ :gay => "Gayo",
+ :gba => "Gbaya",
+ :gd => "Schots Gaelic",
+ :gem => "Germaanse taal",
+ :gez => "Geez",
+ :gil => "Gilbertees",
+ :gl => "Galicisch",
+ :gmh => "Middelhoogduits",
+ :gn => "Guarani",
+ :goh => "Oudhoogduits",
+ :gon => "Gondi",
+ :gor => "Gorontalo",
+ :got => "Gothisch",
+ :grb => "Grebo",
+ :grc => "Oudgrieks",
+ :gsw => "Zwitsers Duits",
+ :gu => "Gujarati",
+ :gv => "Manx",
+ :gwi => "Gwichʼin",
+ :ha => "Hausa",
+ :hai => "Haida",
+ :haw => "Hawaïaans",
+ :he => "Hebreeuws",
+ :hi => "Hindi",
+ :hil => "Hiligaynon",
+ :him => "Himachali",
+ :hit => "Hettitisch",
+ :hmn => "Hmong",
+ :ho => "Hiri Motu",
+ :hr => "Kroatisch",
+ :hsb => "Oppersorbisch",
+ :ht => "Haïtiaans",
+ :hu => "Hongaars",
+ :hup => "Hupa",
+ :hy => "Armeens",
+ :hz => "Herero",
+ :ia => "Interlingua",
+ :iba => "Iban",
+ :id => "Indonesisch",
+ :ie => "Interlingue",
+ :ig => "Igbo",
+ :ii => "Sichuan Yi",
+ :ijo => "Ijo",
+ :ik => "Inupiaq",
+ :ilo => "Iloko",
+ :inc => "Indische taal",
+ :ine => "Indo-Europese taal",
+ :inh => "Ingoesj",
+ :io => "Ido",
+ :ira => "Iraanse taal",
+ :iro => "Irokese taal",
+ :is => "IJslands",
+ :it => "Italiaans",
+ :iu => "Inuktitut",
+ :ja => "Japans",
+ :jbo => "Lojban",
+ :jpr => "Judeo-Perzisch",
+ :jrb => "Judeo-Arabisch",
+ :jv => "Javaans",
+ :ka => "Georgisch",
+ :kaa => "Karakalpaks",
+ :kab => "Kabyle",
+ :kac => "Kachin",
+ :kaj => "Jju",
+ :kam => "Kamba",
+ :kar => "Karen",
+ :kaw => "Kawi",
+ :kbd => "Kabardisch",
+ :kcg => "Tyap",
+ :kfo => "Koro",
+ :kg => "Kongo",
+ :kha => "Khasi",
+ :khi => "Khoisan-taal",
+ :kho => "Khotanees",
+ :ki => "Kikuyu",
+ :kj => "Kuanyama",
+ :kk => "Kazachs",
+ :kl => "Kalaallisut",
+ :km => "Khmer",
+ :kmb => "Kimbundu",
+ :kn => "Kannada",
+ :ko => "Koreaans",
+ :kok => "Konkani",
+ :kos => "Kosraeaans",
+ :kpe => "Kpelle",
+ :kr => "Kanuri",
+ :krc => "Karachay-Balkar",
+ :krl => "Karelisch",
+ :kro => "Kru",
+ :kru => "Kurukh",
+ :ks => "Kashmiri",
+ :ku => "Koerdisch",
+ :kum => "Kumyk",
+ :kut => "Kutenai",
+ :kv => "Komi",
+ :kw => "Cornish",
+ :ky => "Kirgizisch",
+ :la => "Latijn",
+ :lad => "Ladino",
+ :lah => "Lahnda",
+ :lam => "Lamba",
+ :lb => "Luxemburgs",
+ :lez => "Lezgisch",
+ :lg => "Ganda",
+ :li => "Limburgs",
+ :ln => "Lingala",
+ :lo => "Lao",
+ :lol => "Mongo",
+ :loz => "Lozi",
+ :lt => "Litouws",
+ :lu => "Luba-Katanga",
+ :lua => "Luba-Lulua",
+ :lui => "Luiseno",
+ :lun => "Lunda",
+ :luo => "Luo",
+ :lus => "Lushai",
+ :lv => "Letlands",
+ :mad => "Madurees",
+ :mag => "Magahi",
+ :mai => "Maithili",
+ :mak => "Makassaars",
+ :man => "Mandingo",
+ :map => "Austronesisch",
+ :mas => "Masai",
+ :mdf => "Moksha",
+ :mdr => "Mandar",
+ :men => "Mende",
+ :mg => "Malagasisch",
+ :mga => "Middeliers",
+ :mh => "Marshallees",
+ :mi => "Maori",
+ :mic => "Mi'kmaq",
+ :min => "Minangkabau",
+ :mis => "Diverse talen",
+ :mk => "Macedonisch",
+ :mkh => "Mon-Khmer-taal",
+ :ml => "Malayalam",
+ :mn => "Mongools",
+ :mnc => "Mantsjoe",
+ :mni => "Manipoeri",
+ :mno => "Manobo-taal",
+ :mo => "Moldavisch",
+ :moh => "Mohawk",
+ :mos => "Mossi",
+ :mr => "Marathi",
+ :ms => "Maleis",
+ :mt => "Maltees",
+ :mul => "Meerdere talen",
+ :mun => "Munda-taal",
+ :mus => "Creek",
+ :mwl => "Mirandees",
+ :mwr => "Marwari",
+ :my => "Birmees",
+ :myn => "Mayan-taal",
+ :myv => "Erzya",
+ :na => "Nauru",
+ :nah => "Nahuatl",
+ :nai => "Noord-Amerikaans Indiaanse taal",
+ :nap => "Napolitaans",
+ :nb => "Noors - Bokmål",
+ :nd => "Noord-Ndbele",
+ :nds => "Laagduits",
+ :ne => "Nepalees",
+ :new => "Newari",
+ :ng => "Ndonga",
+ :nia => "Nias",
+ :nic => "Niger-Kordofanische taal",
+ :niu => "Niueaans",
+ :nl => "Nederlands",
+ :"nl-BE" => "Vlaams",
+ :nn => "Noors - Nynorsk",
+ :no => "Noors",
+ :nog => "Nogai",
+ :non => "Oudnoors",
+ :nqo => "N’ko",
+ :nr => "Zuid-Ndbele",
+ :nso => "Noord-Sotho",
+ :nub => "Nubische taal",
+ :nv => "Navajo",
+ :nwc => "Klassiek Newari",
+ :ny => "Nyanja",
+ :nym => "Nyamwezi",
+ :nyn => "Nyankole",
+ :nyo => "Nyoro",
+ :nzi => "Nzima",
+ :oc => "Occitaans",
+ :oj => "Ojibwa",
+ :om => "Oromo",
+ :or => "Oriya",
+ :os => "Ossetisch",
+ :osa => "Osage",
+ :ota => "Ottomaans-Turks",
+ :oto => "Otomi-taal",
+ :pa => "Punjabi",
+ :paa => "Papoeataal",
+ :pag => "Pangasinan",
+ :pal => "Pahlavi",
+ :pam => "Pampanga",
+ :pap => "Papiamento",
+ :pau => "Palauaans",
+ :peo => "Oudperzisch",
+ :phi => "Filippijnse taal",
+ :phn => "Foenicisch",
+ :pi => "Pali",
+ :pl => "Pools",
+ :pon => "Pohnpeiaans",
+ :pra => "Prakrit-taal",
+ :pro => "Oudprovençaals",
+ :ps => "Pasjtoe",
+ :pt => "Portugees",
+ :"pt-BR" => "Braziliaans Portugees",
+ :"pt-PT" => "Iberisch Portugees",
+ :qu => "Quechua",
+ :raj => "Rajasthani",
+ :rap => "Rapanui",
+ :rar => "Rarotongan",
+ :rm => "Reto-Romaans",
+ :rn => "Rundi",
+ :ro => "Roemeens",
+ :roa => "Romaanse taal",
+ :rom => "Romani",
+ :ru => "Russisch",
+ :rup => "Aromaniaans",
+ :rw => "Kinyarwanda",
+ :sa => "Sanskriet",
+ :sad => "Sandawe",
+ :sah => "Yakut",
+ :sai => "Zuid-Amerikaans Indiaanse taal",
+ :sal => "Salishan-taal",
+ :sam => "Samaritaans-Aramees",
+ :sas => "Sasak",
+ :sat => "Santali",
+ :sc => "Sardinisch",
+ :scn => "Siciliaans",
+ :sco => "Schots",
+ :sd => "Sindhi",
+ :se => "Noord-Samisch",
+ :sel => "Selkup",
+ :sem => "Semitische taal",
+ :sg => "Sango",
+ :sga => "Oudiers",
+ :sgn => "Gebarentaal",
+ :sh => "Servokroatisch",
+ :shn => "Shan",
+ :si => "Singalees",
+ :sid => "Sidamo",
+ :sio => "Siouaanse talen",
+ :sit => "Sino-Tibetaanse taal",
+ :sk => "Slowaaks",
+ :sl => "Sloveens",
+ :sla => "Slavische taal",
+ :sm => "Samoaans",
+ :sma => "Zuid-Samisch",
+ :smi => "Sami-taal",
+ :smj => "Lule Sami",
+ :smn => "Inari Sami",
+ :sms => "Skolt Sami",
+ :sn => "Shona",
+ :snk => "Soninke",
+ :so => "Somalisch",
+ :sog => "Sogdisch",
+ :son => "Songhai",
+ :sq => "Albanees",
+ :sr => "Servisch",
+ :srn => "Sranantongo",
+ :srr => "Serer",
+ :ss => "Swati",
+ :ssa => "Nilo-Saharaanse taal",
+ :st => "Zuid-Sotho",
+ :su => "Soendanees",
+ :suk => "Sukuma",
+ :sus => "Soesoe",
+ :sux => "Soemerisch",
+ :sv => "Zweeds",
+ :sw => "Swahili",
+ :syc => "Klassiek Syrisch",
+ :syr => "Syriac",
+ :ta => "Tamil",
+ :tai => "Tai-taal",
+ :te => "Teloegoe",
+ :tem => "Timne",
+ :ter => "Tereno",
+ :tet => "Tetum",
+ :tg => "Tadzjieks",
+ :th => "Thais",
+ :ti => "Tigrinya",
+ :tig => "Tigre",
+ :tiv => "Tiv",
+ :tk => "Turkmeens",
+ :tkl => "Tokelau",
+ :tl => "Tagalog",
+ :tlh => "Klingon",
+ :tli => "Tlingit",
+ :tmh => "Tamashek",
+ :tn => "Tswana",
+ :to => "Tonga",
+ :tog => "Nyasa Tonga",
+ :tpi => "Tok Pisin",
+ :tr => "Turks",
+ :ts => "Tsonga",
+ :tsi => "Tsimshian",
+ :tt => "Tataars",
+ :tum => "Toemboeka",
+ :tup => "Tupi-taal",
+ :tut => "Altaïsche taal",
+ :tvl => "Tuvalu",
+ :tw => "Twi",
+ :ty => "Tahitisch",
+ :tyv => "Tuvinisch",
+ :udm => "Udmurt",
+ :ug => "Oeigoers",
+ :uga => "Oegaritisch",
+ :uk => "Oekraïens",
+ :umb => "Umbundu",
+ :und => "Onbepaald",
+ :ur => "Urdu",
+ :uz => "Oezbeeks",
+ :vai => "Vai",
+ :ve => "Venda",
+ :vi => "Vietnamees",
+ :vo => "Volapük",
+ :vot => "Votisch",
+ :wa => "Wallonisch",
+ :wak => "Wakashan-taal",
+ :wal => "Walamo",
+ :war => "Waray",
+ :was => "Washo",
+ :wen => "Sorbische taal",
+ :wo => "Wolof",
+ :xal => "Kalmyk",
+ :xh => "Xhosa",
+ :yao => "Yao",
+ :yap => "Yapees",
+ :yi => "Jiddisch",
+ :yo => "Yoruba",
+ :ypk => "Yupik-talen",
+ :za => "Zhuang",
+ :zap => "Zapotec",
+ :zbl => "Blissymbolen",
+ :zen => "Zenaga",
+ :zh => "Chinees",
+ :"zh-Hans" => "Vereenvoudigd Chinees",
+ :"zh-Hant" => "Traditioneel Chinees",
+ :znd => "Zande",
+ :zu => "Zulu",
+ :zun => "Zuni",
+ :zxx => "Geen linguïstische inhoud",
+ :zza => "Zaza",
+ }
+ }
+}
87 tasks/localized_language_select_tasks.rake
@@ -0,0 +1,87 @@
+require 'rubygems'
+require 'hpricot'
+require 'open-uri'
+
+# Rake task for importing language names from Unicode.org's CLDR repository
+# (http://www.unicode.org/cldr/data/charts/summary/root.html).
+#
+# It parses a HTML file from Unicode.org for given locale and saves the
+# Rails' I18n hash in the plugin +locale+ directory
+#
+# Don't forget to restart the application when you add new locale to load it into Rails!
+#
+# == Example
+# rake import:language_select 'de'
+#
+# The code is deliberately procedural and simple, so it's easily
+# understandable by beginners as an introduction to Rake tasks power.
+# See http://github.com/joshmh/cldr/tree/master/converter.rb for much more robust solution
+
+namespace :import do
+
+ desc "Import language codes and names for various languages from the Unicode.org CLDR archive. Depends on Hpricot gem."
+ task :language_select do
+
+ # TODO : Implement locale import chooser from CLDR root via Highline
+
+ # Setup variables
+ locale = ARGV[1]
+ unless locale
+ puts "\n[!] Usage: rake import:language_select de\n\n"
+ exit 0
+ end
+
+ # ----- Get the CLDR HTML --------------------------------------------------
+ begin
+ puts "... getting the HTML file for locale '#{locale}'"
+ doc = Hpricot( open("http://www.unicode.org/cldr/data/charts/summary/#{locale}.html") )
+ rescue => e
+ puts "[!] Invalid locale name '#{locale}'! Not found in CLDR (#{e})"
+ exit 0
+ end
+
+ require 'ruby-debug'
+
+ # ----- Parse the HTML with Hpricot ----------------------------------------
+ puts "... parsing the HTML file"
+ languages = []
+ doc.search("//tr").each do |row|
+ if row.search("td[@class='n']") &&
+ row.search("td[@class='n']").inner_html =~ /^nameslanguage$/ &&
+ row.search("td[@class='g']").inner_html =~ /^[a-z]{2,3}(?:_([A-Z][a-z]{3}))?(?:_([A-Z]{2}))?$/
+ code = row.search("td[@class='g']").inner_text
+ code.sub!('_','-')
+ #debugger if code =~ /-/
+ name = row.search("td[@class='v']").first.inner_text
+ languages << { :code => code.to_sym, :name => name.to_s }
+ print " ... #{name}"
+ end
+ end
+
+
+ # ----- Prepare the output format ------------------------------------------
+ output =<<HEAD
+{
+ :#{locale} => {
+ :languages => {
+HEAD
+ languages.each do |language|
+ output << " #{language[:code].inspect} => \"#{language[:name]}\",\n"
+ end
+ output <<<<TAIL
+ }
+ }
+}
+TAIL
+
+
+ # ----- Write the parsed values into file ---------------------------------
+ puts "\n... writing the output"
+ filename = File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb")
+ filename += '.NEW' if File.exists?(filename) # Append 'NEW' if file exists
+ File.open(filename, 'w+') { |f| f << output }
+ puts "\n---\nWritten values for the '#{locale}' into file: #{filename}\n"
+ # ------------------------------------------------------------------------------
+ end
+
+end
86 test/localized_language_select_test.rb
@@ -0,0 +1,86 @@
+require 'test/unit'
+
+require 'rubygems'
+require 'active_support'
+require 'action_controller'
+require 'action_controller/test_process'
+require 'action_view'
+require 'action_view/helpers/tag_helper'
+require 'i18n'
+
+require 'localized_language_select'
+
+class LocalizedLanguageSelectTest < Test::Unit::TestCase
+
+ include ActionView::Helpers::FormOptionsHelper
+ include ActionView::Helpers::TagHelper
+
+ def test_action_view_should_include_helper_for_object
+ assert ActionView::Helpers::FormBuilder.instance_methods.include?('localized_language_select')
+ assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select')
+ end
+
+ def test_action_view_should_include_helper_tag
+ assert ActionView::Helpers::FormOptionsHelper.instance_methods.include?('localized_language_select_tag')
+ end
+
+ def test_should_return_select_tag_with_proper_name_for_object
+ assert localized_language_select(:user, :language) =~
+ Regexp.new(Regexp.escape('<select id="user_language" name="user[language]">')),
+ "Should have proper name for object"
+ end
+
+ def test_should_return_select_tag_with_proper_name
+ assert localized_language_select_tag( "competition_submission[data][language]", nil) =~
+ Regexp.new(
+ Regexp.escape('<select id="competition_submission[data][language]" name="competition_submission[data][language]">') ),
+ "Should have proper name"
+ end
+
+ def test_should_return_option_tags
+ assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">Spanish</option>'))
+ end
+
+ def test_should_return_localized_option_tags
+ I18n.locale = 'fr'
+ assert localized_language_select(:user, :language) =~ Regexp.new(Regexp.escape('<option value="es">espagnol</option>'))
+ end
+
+ def test_should_return_priority_languages_first
+ assert localized_language_options_for_select(nil, [:es, :fr]) =~ Regexp.new(
+ Regexp.escape("<option value=\"es\">Spanish</option>\n<option value=\"fr\">French</option><option value=\"\" disabled=\"disabled\">-------------</option>\n<option value=\"aa\">Afar</option>\n"))
+ end
+
+ def test_i18n_should_know_about_languages
+ assert_equal 'Spanish', I18n.t('es', :scope => 'languages')
+ I18n.locale = 'fr'
+ assert_equal 'espagnol', I18n.t('es', :scope => 'languages')
+ end
+
+ def test_localized_languages_array_returns_correctly
+ assert_nothing_raised { LocalizedLanguageSelect::localized_languages_array() }
+ I18n.locale = 'en'
+ assert_equal 504, LocalizedLanguageSelect::localized_languages_array.size
+ assert_equal 'Afar', LocalizedLanguageSelect::localized_languages_array.first[0]
+ I18n.locale = 'fr'
+ assert_equal 503, LocalizedLanguageSelect::localized_languages_array.size
+ assert_equal 'afar', LocalizedLanguageSelect::localized_languages_array.first[0]
+ end
+
+ def test_priority_languages_returns_correctly_and_in_correct_order
+ assert_nothing_raised { LocalizedLanguageSelect::priority_languages_array([:nl, :fr]) }
+ I18n.locale = 'en'
+ assert_equal [ ['Dutch', 'nl'], ['French', 'fr'] ], LocalizedLanguageSelect::priority_languages_array([:nl, :fr])
+ end
+
+ private
+
+ def setup
+ ['fr', 'en'].each do |locale|
+ # I18n.load_translations( File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb") ) # <-- Old style! :)
+ I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locale', "#{locale}.rb") ]
+ end
+ I18n.locale = 'en'
+ end
+
+end
1 uninstall.rb
@@ -0,0 +1 @@
+# Uninstall hook code here

0 comments on commit 7d319f1

Please sign in to comment.
Something went wrong with that request. Please try again.