iso_code 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +2 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +32 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +27 -0
- data/Rakefile +53 -0
- data/init.rb +4 -0
- data/iso_code.gemspec +85 -0
- data/lib/iso_code.rb +13 -0
- data/lib/iso_code/base.rb +80 -0
- data/lib/iso_code/iso3166.rb +139 -0
- data/lib/iso_code/iso639.rb +117 -0
- data/lib/iso_code/version.rb +13 -0
- data/spec/iso_code_spec.rb +7 -0
- data/spec/spec_helper.rb +8 -0
- metadata +242 -0
data/.document
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.6.4)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
nokogiri (1.5.0)
|
11
|
+
rake (0.9.2)
|
12
|
+
rcov (0.9.9)
|
13
|
+
rspec (2.3.0)
|
14
|
+
rspec-core (~> 2.3.0)
|
15
|
+
rspec-expectations (~> 2.3.0)
|
16
|
+
rspec-mocks (~> 2.3.0)
|
17
|
+
rspec-core (2.3.1)
|
18
|
+
rspec-expectations (2.3.0)
|
19
|
+
diff-lcs (~> 1.1.2)
|
20
|
+
rspec-mocks (2.3.0)
|
21
|
+
yard (0.6.8)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
bundler (~> 1.0.0)
|
28
|
+
jeweler (~> 1.6.4)
|
29
|
+
nokogiri
|
30
|
+
rcov
|
31
|
+
rspec (~> 2.3.0)
|
32
|
+
yard (~> 0.6.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Thomas Boerger <tboerger@tbpro.de>
|
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.
|
data/README.rdoc
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
= iso_code
|
2
|
+
|
3
|
+
It translate all available languages (ISO 639-3) and countries (ISO 3166) into various languages.
|
4
|
+
|
5
|
+
== Install
|
6
|
+
|
7
|
+
gem 'iso_code'
|
8
|
+
|
9
|
+
== Usage
|
10
|
+
|
11
|
+
This returns all available countries in english, german and polish.
|
12
|
+
|
13
|
+
require 'iso_code'
|
14
|
+
IsoCode::Iso3166.new(:de, :pl).read
|
15
|
+
|
16
|
+
This returns all available languages in english, german and polish.
|
17
|
+
|
18
|
+
require 'iso_code'
|
19
|
+
IsoCode::Iso639.new(:de, :pl).read
|
20
|
+
|
21
|
+
== Todo
|
22
|
+
|
23
|
+
Implement functionality for scriptnames, subdevisions and currencies.
|
24
|
+
|
25
|
+
== Credits
|
26
|
+
|
27
|
+
The project <tt>iso_code</tt> have been inspired by the debian iso-code project.
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Created by Thomas Boerger on 2011-07-06.
|
2
|
+
# Copyright (c) 2011. All rights reserved.
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'bundler'
|
6
|
+
|
7
|
+
begin
|
8
|
+
Bundler.setup(:default, :development)
|
9
|
+
rescue Bundler::BundlerError => e
|
10
|
+
$stderr.puts e.message
|
11
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
12
|
+
exit e.status_code
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'rake'
|
16
|
+
require 'jeweler'
|
17
|
+
require 'rspec/core'
|
18
|
+
require 'rspec/core/rake_task'
|
19
|
+
require 'yard'
|
20
|
+
|
21
|
+
require 'iso_code'
|
22
|
+
|
23
|
+
Jeweler::Tasks.new do |gem|
|
24
|
+
gem.name = 'iso_code'
|
25
|
+
gem.version = IsoCode::Version::STRING
|
26
|
+
gem.homepage = 'https://github.com/tbpro/iso_code'
|
27
|
+
gem.license = 'MIT'
|
28
|
+
gem.summary = %Q{Countries and languages by ISO codes}
|
29
|
+
gem.description = %Q{Translate many available languages (ISO 639-3) and countries (ISO 3166) into requested languages}
|
30
|
+
gem.email = 'tboerger@tbpro.de'
|
31
|
+
gem.author = 'Thomas Boerger'
|
32
|
+
gem.add_dependency('nokogiri')
|
33
|
+
gem.add_development_dependency('rspec')
|
34
|
+
gem.add_development_dependency('yard')
|
35
|
+
gem.add_development_dependency('jeweler')
|
36
|
+
gem.add_development_dependency('rcov')
|
37
|
+
end
|
38
|
+
|
39
|
+
Jeweler::RubygemsDotOrgTasks.new
|
40
|
+
|
41
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
42
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
43
|
+
end
|
44
|
+
|
45
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
46
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
47
|
+
spec.rcov = true
|
48
|
+
end
|
49
|
+
|
50
|
+
YARD::Rake::YardocTask.new
|
51
|
+
|
52
|
+
task :test => :spec
|
53
|
+
task :default => :spec
|
data/init.rb
ADDED
data/iso_code.gemspec
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{iso_code}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Thomas Boerger"]
|
12
|
+
s.date = %q{2011-07-15}
|
13
|
+
s.description = %q{Translate many available languages (ISO 639-3) and countries (ISO 3166) into requested languages}
|
14
|
+
s.email = %q{tboerger@tbpro.de}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"init.rb",
|
28
|
+
"iso_code.gemspec",
|
29
|
+
"lib/iso_code.rb",
|
30
|
+
"lib/iso_code/base.rb",
|
31
|
+
"lib/iso_code/iso3166.rb",
|
32
|
+
"lib/iso_code/iso639.rb",
|
33
|
+
"lib/iso_code/version.rb",
|
34
|
+
"spec/iso_code_spec.rb",
|
35
|
+
"spec/spec_helper.rb"
|
36
|
+
]
|
37
|
+
s.homepage = %q{https://github.com/tbpro/iso_code}
|
38
|
+
s.licenses = ["MIT"]
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = %q{1.7.2}
|
41
|
+
s.summary = %q{Countries and languages by ISO codes}
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
48
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
49
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
50
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
51
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
52
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
53
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
54
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
58
|
+
else
|
59
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
60
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
61
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
62
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
63
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
64
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
65
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
66
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
67
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
68
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
69
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
70
|
+
end
|
71
|
+
else
|
72
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
73
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
74
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
75
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
76
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
77
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
78
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
79
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
80
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
81
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
82
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
data/lib/iso_code.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Created by Thomas Boerger on 2011-07-06.
|
2
|
+
# Copyright (c) 2011. All rights reserved.
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'nokogiri'
|
6
|
+
require 'open-uri'
|
7
|
+
|
8
|
+
module IsoCode
|
9
|
+
autoload :Version, 'iso_code/version'
|
10
|
+
autoload :Base, 'iso_code/base'
|
11
|
+
autoload :Iso3166, 'iso_code/iso3166'
|
12
|
+
autoload :Iso639, 'iso_code/iso639'
|
13
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# Created by Thomas Boerger on 2011-07-06.
|
2
|
+
# Copyright (c) 2011. All rights reserved.
|
3
|
+
|
4
|
+
module IsoCode
|
5
|
+
# This class acts as base class for various iso code classes
|
6
|
+
# to implement methods that will be used on all classes
|
7
|
+
class Base
|
8
|
+
# Save the requested locales
|
9
|
+
attr_accessor :locales
|
10
|
+
|
11
|
+
# Save the parsed content hash
|
12
|
+
attr_accessor :dataset
|
13
|
+
|
14
|
+
# The path for the base XML file
|
15
|
+
attr_accessor :basexml
|
16
|
+
|
17
|
+
# The path for all the PO files
|
18
|
+
attr_accessor :pofiles
|
19
|
+
|
20
|
+
# Read all requested files and return hash
|
21
|
+
def read
|
22
|
+
parse_basexml
|
23
|
+
parse_pofiles
|
24
|
+
|
25
|
+
@dataset
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
# Parse all the PO files
|
30
|
+
def parse_pofiles
|
31
|
+
detectlocales.each do |locale, pofile|
|
32
|
+
open(pofile) do |f|
|
33
|
+
names = scan_names(f)
|
34
|
+
i18ns = scan_i18ns(f)
|
35
|
+
|
36
|
+
Range.new(0, names.count).each do |i|
|
37
|
+
en_name = split_curname names[i].to_s
|
38
|
+
xx_name = split_curname i18ns[i].to_s
|
39
|
+
|
40
|
+
xx_name = if xx_name.empty?
|
41
|
+
en_name
|
42
|
+
else
|
43
|
+
xx_name
|
44
|
+
end
|
45
|
+
|
46
|
+
@dataset[en_name][locale] = xx_name unless @dataset[en_name].nil?
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Detect requested locales
|
53
|
+
def detectlocales
|
54
|
+
@pofiles.select do |k, v|
|
55
|
+
@locales.include?(:all) or @locales.include?(k)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Scan for base names
|
60
|
+
def scan_names(f)
|
61
|
+
f.rewind
|
62
|
+
f.read.scan(/^msgid\ "(.*)"/)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Scan for i18n names
|
66
|
+
def scan_i18ns(f)
|
67
|
+
f.rewind
|
68
|
+
f.read.scan(/^msgstr\ "(.*)"/)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Split the current name
|
72
|
+
def split_curname(name)
|
73
|
+
if name.include? ', '
|
74
|
+
name.split(', ').reverse.join(' ')
|
75
|
+
else
|
76
|
+
name
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# Created by Thomas Boerger on 2011-07-06.
|
2
|
+
# Copyright (c) 2011. All rights reserved.
|
3
|
+
|
4
|
+
module IsoCode
|
5
|
+
# This class gives a list of all countries in the ISO 3166
|
6
|
+
# standard, and is used to provide translations in various
|
7
|
+
# languages
|
8
|
+
#
|
9
|
+
# The translations and files are taken from the Debian
|
10
|
+
# iso-codes project (https://alioth.debian.org/projects/pkg-isocodes/)
|
11
|
+
class Iso3166
|
12
|
+
def initialize(*locales)
|
13
|
+
@locales = locales
|
14
|
+
@dataset = {}
|
15
|
+
|
16
|
+
@basexml = 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/iso_3166.xml;hb=HEAD'
|
17
|
+
|
18
|
+
@pofiles = {
|
19
|
+
:af => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/af.po;hb=HEAD',
|
20
|
+
:am => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/am.po;hb=HEAD',
|
21
|
+
:ar => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ar.po;hb=HEAD',
|
22
|
+
:as => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/as.po;hb=HEAD',
|
23
|
+
:ast => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ast.po;hb=HEAD',
|
24
|
+
:az => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/az.po;hb=HEAD',
|
25
|
+
:be => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/be.po;hb=HEAD',
|
26
|
+
:bg => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/bg.po;hb=HEAD',
|
27
|
+
:bn => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/bn.po;hb=HEAD',
|
28
|
+
:bn_in => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/bn_in.po;hb=HEAD',
|
29
|
+
:br => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/br.po;hb=HEAD',
|
30
|
+
:bs => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/bs.po;hb=HEAD',
|
31
|
+
:byn => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/byn.po;hb=HEAD',
|
32
|
+
:ca => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ca.po;hb=HEAD',
|
33
|
+
:crh => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/crh.po;hb=HEAD',
|
34
|
+
:cs => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/cs.po;hb=HEAD',
|
35
|
+
:cy => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/cy.po;hb=HEAD',
|
36
|
+
:da => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/da.po;hb=HEAD',
|
37
|
+
:de => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/de.po;hb=HEAD',
|
38
|
+
:dz => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/dz.po;hb=HEAD',
|
39
|
+
:el => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/el.po;hb=HEAD',
|
40
|
+
:eo => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/eo.po;hb=HEAD',
|
41
|
+
:es => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/es.po;hb=HEAD',
|
42
|
+
:et => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/et.po;hb=HEAD',
|
43
|
+
:eu => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/eu.po;hb=HEAD',
|
44
|
+
:fa => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/fa.po;hb=HEAD',
|
45
|
+
:fi => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/fi.po;hb=HEAD',
|
46
|
+
:fo => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/fo.po;hb=HEAD',
|
47
|
+
:fr => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/fr.po;hb=HEAD',
|
48
|
+
:ga => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ga.po;hb=HEAD',
|
49
|
+
:gez => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/gez.po;hb=HEAD',
|
50
|
+
:gl => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/gl.po;hb=HEAD',
|
51
|
+
:gu => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/gu.po;hb=HEAD',
|
52
|
+
:haw => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/haw.po;hb=HEAD',
|
53
|
+
:he => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/he.po;hb=HEAD',
|
54
|
+
:hi => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/hi.po;hb=HEAD',
|
55
|
+
:hr => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/hr.po;hb=HEAD',
|
56
|
+
:hu => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/hu.po;hb=HEAD',
|
57
|
+
:hy => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/hy.po;hb=HEAD',
|
58
|
+
:id => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/id.po;hb=HEAD',
|
59
|
+
:is => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/is.po;hb=HEAD',
|
60
|
+
:it => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/it.po;hb=HEAD',
|
61
|
+
:ja => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ja.po;hb=HEAD',
|
62
|
+
:ka => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ka.po;hb=HEAD',
|
63
|
+
:kk => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/kk.po;hb=HEAD',
|
64
|
+
:km => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/km.po;hb=HEAD',
|
65
|
+
:kn => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/kn.po;hb=HEAD',
|
66
|
+
:ko => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ko.po;hb=HEAD',
|
67
|
+
:ku => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ku.po;hb=HEAD',
|
68
|
+
:lt => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/lt.po;hb=HEAD',
|
69
|
+
:lv => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/lv.po;hb=HEAD',
|
70
|
+
:mi => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/mi.po;hb=HEAD',
|
71
|
+
:mk => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/mk.po;hb=HEAD',
|
72
|
+
:ml => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ml.po;hb=HEAD',
|
73
|
+
:mn => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/mn.po;hb=HEAD',
|
74
|
+
:mr => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/mr.po;hb=HEAD',
|
75
|
+
:ms => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ms.po;hb=HEAD',
|
76
|
+
:mt => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/mt.po;hb=HEAD',
|
77
|
+
:nb => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/nb.po;hb=HEAD',
|
78
|
+
:ne => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ne.po;hb=HEAD',
|
79
|
+
:nl => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/nl.po;hb=HEAD',
|
80
|
+
:nn => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/nn.po;hb=HEAD',
|
81
|
+
:nso => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/nso.po;hb=HEAD',
|
82
|
+
:oc => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/oc.po;hb=HEAD',
|
83
|
+
:or => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/or.po;hb=HEAD',
|
84
|
+
:pa => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/pa.po;hb=HEAD',
|
85
|
+
:pl => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/pl.po;hb=HEAD',
|
86
|
+
:ps => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ps.po;hb=HEAD',
|
87
|
+
:pt => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/pt.po;hb=HEAD',
|
88
|
+
:pt_br => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/pt_br.po;hb=HEAD',
|
89
|
+
:ro => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ro.po;hb=HEAD',
|
90
|
+
:ru => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ru.po;hb=HEAD',
|
91
|
+
:rw => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/rw.po;hb=HEAD',
|
92
|
+
:sk => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/sk.po;hb=HEAD',
|
93
|
+
:sl => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/sl.po;hb=HEAD',
|
94
|
+
:so => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/so.po;hb=HEAD',
|
95
|
+
:sq => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/sq.po;hb=HEAD',
|
96
|
+
:sr => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/sr.po;hb=HEAD',
|
97
|
+
:sv => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/sv.po;hb=HEAD',
|
98
|
+
:sw => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/sw.po;hb=HEAD',
|
99
|
+
:ta => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ta.po;hb=HEAD',
|
100
|
+
:te => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/te.po;hb=HEAD',
|
101
|
+
:th => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/th.po;hb=HEAD',
|
102
|
+
:ti => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ti.po;hb=HEAD',
|
103
|
+
:tig => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/tig.po;hb=HEAD',
|
104
|
+
:tk => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/tk.po;hb=HEAD',
|
105
|
+
:tl => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/tl.po;hb=HEAD',
|
106
|
+
:tr => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/tr.po;hb=HEAD',
|
107
|
+
:tt => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/tt.po;hb=HEAD',
|
108
|
+
:ug => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ug.po;hb=HEAD',
|
109
|
+
:uk => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/uk.po;hb=HEAD',
|
110
|
+
:ve => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/ve.po;hb=HEAD',
|
111
|
+
:vi => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/vi.po;hb=HEAD',
|
112
|
+
:wa => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/wa.po;hb=HEAD',
|
113
|
+
:wal => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/wal.po;hb=HEAD',
|
114
|
+
:wo => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/wo.po;hb=HEAD',
|
115
|
+
:xh => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/xh.po;hb=HEAD',
|
116
|
+
:zh_cn => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/zh_CN.po;hb=HEAD',
|
117
|
+
:zh_hk => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/zh_HK.po;hb=HEAD',
|
118
|
+
:zh_tw => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/zh_TW.po;hb=HEAD',
|
119
|
+
:zu => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/zu.po;hb=HEAD'
|
120
|
+
}
|
121
|
+
end
|
122
|
+
|
123
|
+
protected
|
124
|
+
# Parse the base XML file
|
125
|
+
def parse_basexml
|
126
|
+
Nokogiri::XML(open(@basexml)).search('//iso_3166_entries/iso_3166_entry').each do |row|
|
127
|
+
en_name = split_curname row.attributes['name'].to_s
|
128
|
+
|
129
|
+
@dataset[en_name] = {
|
130
|
+
:alpha2 => row.attributes['alpha_2_code'].to_s,
|
131
|
+
:alpha3 => row.attributes['alpha_3_code'].to_s,
|
132
|
+
:number => row.attributes['numeric_code'].to_s,
|
133
|
+
:withdrawn => row.attributes['date_withdrawn'].to_s || '',
|
134
|
+
:en => en_name
|
135
|
+
}
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# Created by Thomas Boerger on 2011-07-06.
|
2
|
+
# Copyright (c) 2011. All rights reserved.
|
3
|
+
|
4
|
+
module IsoCode
|
5
|
+
# This class gives a list of all languages in the ISO 639-3
|
6
|
+
# standard, and is used to provide translations in various
|
7
|
+
# languages
|
8
|
+
#
|
9
|
+
# The translations and files are taken from the Debian
|
10
|
+
# iso-codes project (https://alioth.debian.org/projects/pkg-isocodes/)
|
11
|
+
class Iso639 < Base
|
12
|
+
def initialize(*locales)
|
13
|
+
@locales = locales
|
14
|
+
@dataset = {}
|
15
|
+
|
16
|
+
@basexml = 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/iso_639_3.xml;hb=HEAD'
|
17
|
+
|
18
|
+
@pofiles = {
|
19
|
+
:af => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/af.po;hb=HEAD',
|
20
|
+
:am => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/am.po;hb=HEAD',
|
21
|
+
:ar => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ar.po;hb=HEAD',
|
22
|
+
:az => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/az.po;hb=HEAD',
|
23
|
+
:bg => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/bg.po;hb=HEAD',
|
24
|
+
:bn_in => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/bn_in.po;hb=HEAD',
|
25
|
+
:br => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/br.po;hb=HEAD',
|
26
|
+
:bs => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/bs.po;hb=HEAD',
|
27
|
+
:byn => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/byn.po;hb=HEAD',
|
28
|
+
:ca => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ca.po;hb=HEAD',
|
29
|
+
:crh => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/crh.po;hb=HEAD',
|
30
|
+
:cs => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/cs.po;hb=HEAD',
|
31
|
+
:cy => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/cy.po;hb=HEAD',
|
32
|
+
:da => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/da.po;hb=HEAD',
|
33
|
+
:de => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/de.po;hb=HEAD',
|
34
|
+
:el => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/el.po;hb=HEAD',
|
35
|
+
:eo => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/eo.po;hb=HEAD',
|
36
|
+
:es => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/es.po;hb=HEAD',
|
37
|
+
:et => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/et.po;hb=HEAD',
|
38
|
+
:eu => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/eu.po;hb=HEAD',
|
39
|
+
:fa => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/fa.po;hb=HEAD',
|
40
|
+
:fi => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/fi.po;hb=HEAD',
|
41
|
+
:fr => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/fr.po;hb=HEAD',
|
42
|
+
:ga => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ga.po;hb=HEAD',
|
43
|
+
:gez => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/gez.po;hb=HEAD',
|
44
|
+
:gl => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/gl.po;hb=HEAD',
|
45
|
+
:gu => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/gu.po;hb=HEAD',
|
46
|
+
:he => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/he.po;hb=HEAD',
|
47
|
+
:hi => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/hi.po;hb=HEAD',
|
48
|
+
:hr => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/hr.po;hb=HEAD',
|
49
|
+
:hu => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/hu.po;hb=HEAD',
|
50
|
+
:id => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/id.po;hb=HEAD',
|
51
|
+
:is => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/is.po;hb=HEAD',
|
52
|
+
:it => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/it.po;hb=HEAD',
|
53
|
+
:ja => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ja.po;hb=HEAD',
|
54
|
+
:kn => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/kn.po;hb=HEAD',
|
55
|
+
:ko => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ko.po;hb=HEAD',
|
56
|
+
:kok => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/kok.po;hb=HEAD',
|
57
|
+
:lt => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/lt.po;hb=HEAD',
|
58
|
+
:lv => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/lv.po;hb=HEAD',
|
59
|
+
:mi => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/mi.po;hb=HEAD',
|
60
|
+
:mk => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/mk.po;hb=HEAD',
|
61
|
+
:mn => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/mn.po;hb=HEAD',
|
62
|
+
:mr => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/mr.po;hb=HEAD',
|
63
|
+
:ms => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ms.po;hb=HEAD',
|
64
|
+
:mt => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/mt.po;hb=HEAD',
|
65
|
+
:nb => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/nb.po;hb=HEAD',
|
66
|
+
:nl => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/nl.po;hb=HEAD',
|
67
|
+
:nn => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/nn.po;hb=HEAD',
|
68
|
+
:nso => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/nso.po;hb=HEAD',
|
69
|
+
:oc => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/oc.po;hb=HEAD',
|
70
|
+
:or => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/or.po;hb=HEAD',
|
71
|
+
:pa => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/pa.po;hb=HEAD',
|
72
|
+
:pl => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/pl.po;hb=HEAD',
|
73
|
+
:ps => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ps.po;hb=HEAD',
|
74
|
+
:pt => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/pt.po;hb=HEAD',
|
75
|
+
:pt_br => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/pt_br.po;hb=HEAD',
|
76
|
+
:ro => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ro.po;hb=HEAD',
|
77
|
+
:ru => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ru.po;hb=HEAD',
|
78
|
+
:rw => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/rw.po;hb=HEAD',
|
79
|
+
:sk => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/sk.po;hb=HEAD',
|
80
|
+
:sl => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/sl.po;hb=HEAD',
|
81
|
+
:sr => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/sr.po;hb=HEAD',
|
82
|
+
:sv => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/sv.po;hb=HEAD',
|
83
|
+
:ta => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ta.po;hb=HEAD',
|
84
|
+
:th => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/th.po;hb=HEAD',
|
85
|
+
:ti => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ti.po;hb=HEAD',
|
86
|
+
:tig => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/tig.po;hb=HEAD',
|
87
|
+
:tr => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/tr.po;hb=HEAD',
|
88
|
+
:tt => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/tt.po;hb=HEAD',
|
89
|
+
:uk => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/uk.po;hb=HEAD',
|
90
|
+
:ve => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/ve.po;hb=HEAD',
|
91
|
+
:vi => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/vi.po;hb=HEAD',
|
92
|
+
:wa => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/wa.po;hb=HEAD',
|
93
|
+
:xh => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/xh.po;hb=HEAD',
|
94
|
+
:zh_cn => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/zh_CN.po;hb=HEAD',
|
95
|
+
:zh_tw => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/zh_TW.po;hb=HEAD',
|
96
|
+
:zu => 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/zu.po;hb=HEAD'
|
97
|
+
}
|
98
|
+
end
|
99
|
+
|
100
|
+
protected
|
101
|
+
# Parse the base XML file
|
102
|
+
def parse_basexml
|
103
|
+
Nokogiri::XML(open(@basexml)).search('//iso_639_3_entries/iso_639_3_entry').each do |row|
|
104
|
+
en_name = split_curname row.attributes['name'].to_s
|
105
|
+
|
106
|
+
@dataset[en_name] = {
|
107
|
+
:code1 => row.attributes['part1_code'].to_s || '',
|
108
|
+
:code2 => row.attributes['part2_code'].to_s || '',
|
109
|
+
:code3 => row.attributes['id'].to_s,
|
110
|
+
:type => row.attributes['type'].to_s.downcase,
|
111
|
+
:scope => row.attributes['scope'].to_s.downcase,
|
112
|
+
:en => en_name
|
113
|
+
}
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,242 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: iso_code
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Thomas Boerger
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-07-15 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
+
none: false
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
hash: 3
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
name: nokogiri
|
31
|
+
prerelease: false
|
32
|
+
type: :runtime
|
33
|
+
requirement: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
hash: 3
|
41
|
+
segments:
|
42
|
+
- 2
|
43
|
+
- 3
|
44
|
+
- 0
|
45
|
+
version: 2.3.0
|
46
|
+
name: rspec
|
47
|
+
prerelease: false
|
48
|
+
type: :development
|
49
|
+
requirement: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 7
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
- 6
|
60
|
+
- 0
|
61
|
+
version: 0.6.0
|
62
|
+
name: yard
|
63
|
+
prerelease: false
|
64
|
+
type: :development
|
65
|
+
requirement: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ~>
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 23
|
73
|
+
segments:
|
74
|
+
- 1
|
75
|
+
- 0
|
76
|
+
- 0
|
77
|
+
version: 1.0.0
|
78
|
+
name: bundler
|
79
|
+
prerelease: false
|
80
|
+
type: :development
|
81
|
+
requirement: *id004
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ~>
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 7
|
89
|
+
segments:
|
90
|
+
- 1
|
91
|
+
- 6
|
92
|
+
- 4
|
93
|
+
version: 1.6.4
|
94
|
+
name: jeweler
|
95
|
+
prerelease: false
|
96
|
+
type: :development
|
97
|
+
requirement: *id005
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
hash: 3
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
version: "0"
|
108
|
+
name: rcov
|
109
|
+
prerelease: false
|
110
|
+
type: :development
|
111
|
+
requirement: *id006
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
hash: 3
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
version: "0"
|
122
|
+
name: nokogiri
|
123
|
+
prerelease: false
|
124
|
+
type: :runtime
|
125
|
+
requirement: *id007
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
hash: 3
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
version: "0"
|
136
|
+
name: rspec
|
137
|
+
prerelease: false
|
138
|
+
type: :development
|
139
|
+
requirement: *id008
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
142
|
+
none: false
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
hash: 3
|
147
|
+
segments:
|
148
|
+
- 0
|
149
|
+
version: "0"
|
150
|
+
name: yard
|
151
|
+
prerelease: false
|
152
|
+
type: :development
|
153
|
+
requirement: *id009
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
hash: 3
|
161
|
+
segments:
|
162
|
+
- 0
|
163
|
+
version: "0"
|
164
|
+
name: jeweler
|
165
|
+
prerelease: false
|
166
|
+
type: :development
|
167
|
+
requirement: *id010
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
hash: 3
|
175
|
+
segments:
|
176
|
+
- 0
|
177
|
+
version: "0"
|
178
|
+
name: rcov
|
179
|
+
prerelease: false
|
180
|
+
type: :development
|
181
|
+
requirement: *id011
|
182
|
+
description: Translate many available languages (ISO 639-3) and countries (ISO 3166) into requested languages
|
183
|
+
email: tboerger@tbpro.de
|
184
|
+
executables: []
|
185
|
+
|
186
|
+
extensions: []
|
187
|
+
|
188
|
+
extra_rdoc_files:
|
189
|
+
- LICENSE.txt
|
190
|
+
- README.rdoc
|
191
|
+
files:
|
192
|
+
- .document
|
193
|
+
- .rspec
|
194
|
+
- Gemfile
|
195
|
+
- Gemfile.lock
|
196
|
+
- LICENSE.txt
|
197
|
+
- README.rdoc
|
198
|
+
- Rakefile
|
199
|
+
- init.rb
|
200
|
+
- iso_code.gemspec
|
201
|
+
- lib/iso_code.rb
|
202
|
+
- lib/iso_code/base.rb
|
203
|
+
- lib/iso_code/iso3166.rb
|
204
|
+
- lib/iso_code/iso639.rb
|
205
|
+
- lib/iso_code/version.rb
|
206
|
+
- spec/iso_code_spec.rb
|
207
|
+
- spec/spec_helper.rb
|
208
|
+
homepage: https://github.com/tbpro/iso_code
|
209
|
+
licenses:
|
210
|
+
- MIT
|
211
|
+
post_install_message:
|
212
|
+
rdoc_options: []
|
213
|
+
|
214
|
+
require_paths:
|
215
|
+
- lib
|
216
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
218
|
+
requirements:
|
219
|
+
- - ">="
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
hash: 3
|
222
|
+
segments:
|
223
|
+
- 0
|
224
|
+
version: "0"
|
225
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
|
+
none: false
|
227
|
+
requirements:
|
228
|
+
- - ">="
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
hash: 3
|
231
|
+
segments:
|
232
|
+
- 0
|
233
|
+
version: "0"
|
234
|
+
requirements: []
|
235
|
+
|
236
|
+
rubyforge_project:
|
237
|
+
rubygems_version: 1.7.2
|
238
|
+
signing_key:
|
239
|
+
specification_version: 3
|
240
|
+
summary: Countries and languages by ISO codes
|
241
|
+
test_files: []
|
242
|
+
|