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