iso_code 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -2
- data/iso_code.gemspec +2 -2
- data/lib/iso_code/base.rb +12 -14
- data/lib/iso_code/iso3166.rb +12 -107
- data/lib/iso_code/iso639.rb +11 -84
- data/lib/iso_code/version.rb +1 -1
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -20,8 +20,12 @@ This returns all available languages in english, german and polish.
|
|
20
20
|
|
21
21
|
== Todo
|
22
22
|
|
23
|
-
|
23
|
+
* Write specs for full cov
|
24
|
+
* Implement scriptnames
|
25
|
+
* Implement subdevisions
|
26
|
+
* Implement currencies
|
24
27
|
|
25
28
|
== Credits
|
26
29
|
|
27
|
-
The project <tt>iso_code</tt> have been inspired by the debian iso-code project
|
30
|
+
The project <tt>iso_code</tt> have been inspired by the debian iso-code project and for the need
|
31
|
+
of translated country names.
|
data/iso_code.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{iso_code}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Thomas Boerger"]
|
12
|
-
s.date = %q{2011-07-
|
12
|
+
s.date = %q{2011-07-18}
|
13
13
|
s.description = %q{Translate many available languages (ISO 639-3) and countries (ISO 3166) into requested languages}
|
14
14
|
s.email = %q{tboerger@tbpro.de}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/iso_code/base.rb
CHANGED
@@ -14,7 +14,10 @@ module IsoCode
|
|
14
14
|
# The path for the base XML file
|
15
15
|
attr_accessor :basexml
|
16
16
|
|
17
|
-
# The
|
17
|
+
# The url to the available po files
|
18
|
+
attr_accessor :fileurl
|
19
|
+
|
20
|
+
# The name for the available PO files
|
18
21
|
attr_accessor :pofiles
|
19
22
|
|
20
23
|
# Read all requested files and return hash
|
@@ -34,8 +37,8 @@ module IsoCode
|
|
34
37
|
i18ns = scan_i18ns(f)
|
35
38
|
|
36
39
|
Range.new(0, names.count).each do |i|
|
37
|
-
en_name =
|
38
|
-
xx_name =
|
40
|
+
en_name = names[i].to_s
|
41
|
+
xx_name = i18ns[i].to_s
|
39
42
|
|
40
43
|
xx_name = if xx_name.empty?
|
41
44
|
en_name
|
@@ -51,8 +54,12 @@ module IsoCode
|
|
51
54
|
|
52
55
|
# Detect requested locales
|
53
56
|
def detectlocales
|
54
|
-
@pofiles.select do |
|
55
|
-
@locales.include?(:all) or @locales.include?(
|
57
|
+
locales = @pofiles.select do |v|
|
58
|
+
@locales.include?(:all) or @locales.include?(v)
|
59
|
+
end
|
60
|
+
|
61
|
+
locales.map do |v|
|
62
|
+
[v, @fileurl % [v.to_s]]
|
56
63
|
end
|
57
64
|
end
|
58
65
|
|
@@ -67,14 +74,5 @@ module IsoCode
|
|
67
74
|
f.rewind
|
68
75
|
f.read.scan(/^msgstr\ "(.*)"/)
|
69
76
|
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
77
|
end
|
80
78
|
end
|
data/lib/iso_code/iso3166.rb
CHANGED
@@ -14,122 +14,27 @@ module IsoCode
|
|
14
14
|
@dataset = {}
|
15
15
|
|
16
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
|
+
@fileurl = 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_3166/%s.po;hb=HEAD'
|
17
18
|
|
18
|
-
@pofiles =
|
19
|
-
:af
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
|
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
|
-
}
|
19
|
+
@pofiles = [
|
20
|
+
:af, :am, :ar, :as, :ast, :az, :be, :bg, :bn, :bn_IN, :br, :bs, :byn, :ca, :crh, :cs, :cy, :da, :de, :dz, :el, :eo,
|
21
|
+
:es, :et, :eu, :fa, :fi, :fo, :fr, :ga, :gez, :gl, :gu, :haw, :he, :hi, :hr, :hu, :hy, :id, :is, :it, :ja, :ka, :kk,
|
22
|
+
:km, :kn, :ko, :ku, :lt, :lv, :mi, :mk, :ml, :mn, :mr, :ms, :mt, :nb, :ne, :nl, :nn, :nso, :oc, :or, :pa, :pl, :ps,
|
23
|
+
:pt, :pt_BR, :ro, :ru, :rw, :sk, :sl, :so, :sq, :sr, :sv, :sw, :ta, :te, :th, :ti, :tig, :tk, :tl, :tr, :tt, :ug,
|
24
|
+
:uk, :ve, :vi, :wa, :wal, :wo, :xh, :zh_CN, :zh_HK, :zh_TW, :zu
|
25
|
+
]
|
121
26
|
end
|
122
27
|
|
123
28
|
protected
|
124
29
|
# Parse the base XML file
|
125
30
|
def parse_basexml
|
126
31
|
Nokogiri::XML(open(@basexml)).search('//iso_3166_entries/iso_3166_entry').each do |row|
|
127
|
-
en_name =
|
32
|
+
en_name = row.attributes['name'].to_s
|
128
33
|
|
129
34
|
@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,
|
35
|
+
:alpha2 => row.attributes['alpha_2_code'].to_s || '',
|
36
|
+
:alpha3 => row.attributes['alpha_3_code'].to_s || '',
|
37
|
+
:number => row.attributes['numeric_code'].to_s || '',
|
133
38
|
:withdrawn => row.attributes['date_withdrawn'].to_s || '',
|
134
39
|
:en => en_name
|
135
40
|
}
|
data/lib/iso_code/iso639.rb
CHANGED
@@ -14,101 +14,28 @@ module IsoCode
|
|
14
14
|
@dataset = {}
|
15
15
|
|
16
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
|
+
@fileurl = 'http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=blob_plain;f=iso_639_3/%s.po;hb=HEAD'
|
17
18
|
|
18
|
-
@pofiles =
|
19
|
-
:af
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
|
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
|
-
}
|
19
|
+
@pofiles = [
|
20
|
+
:af, :am, :ar, :az, :bg, :bn_IN, :br, :bs, :byn, :ca, :crh, :cs, :cy, :da, :de, :el, :eo, :es, :et, :eu, :fa, :fi,
|
21
|
+
:fr, :ga, :gez, :gl, :gu, :he, :hi, :hr, :hu, :id, :is, :it, :ja, :kn, :ko, :kok, :lt, :lv, :mi, :mk, :mn, :mr, :ms,
|
22
|
+
:mt, :nb, :nl, :nn, :nso, :oc, :or, :pa, :pl, :ps, :pt, :pt_BR, :ro, :ru, :rw, :sk, :sl, :sr, :sv, :ta, :th, :ti,
|
23
|
+
:tig, :tr, :tt, :uk, :ve, :vi, :wa, :xh, :zh_CN, :zh_TW, :zu
|
24
|
+
]
|
98
25
|
end
|
99
26
|
|
100
27
|
protected
|
101
28
|
# Parse the base XML file
|
102
29
|
def parse_basexml
|
103
30
|
Nokogiri::XML(open(@basexml)).search('//iso_639_3_entries/iso_639_3_entry').each do |row|
|
104
|
-
en_name =
|
31
|
+
en_name = row.attributes['name'].to_s
|
105
32
|
|
106
33
|
@dataset[en_name] = {
|
107
34
|
:code1 => row.attributes['part1_code'].to_s || '',
|
108
35
|
: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,
|
36
|
+
:code3 => row.attributes['id'].to_s || '',
|
37
|
+
:type => row.attributes['type'].to_s.downcase || '',
|
38
|
+
:scope => row.attributes['scope'].to_s.downcase || '',
|
112
39
|
:en => en_name
|
113
40
|
}
|
114
41
|
end
|
data/lib/iso_code/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iso_code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Thomas Boerger
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|