cocina_display 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/marc_countries.yml +385 -0
- data/config/marc_relators.yml +310 -0
- data/config/searchworks_languages.yml +520 -0
- data/lib/cocina_display/cocina_record.rb +3 -2
- data/lib/cocina_display/concerns/accesses.rb +4 -4
- data/lib/cocina_display/concerns/identifiers.rb +14 -5
- data/lib/cocina_display/contributors/role.rb +12 -1
- data/lib/cocina_display/display_data.rb +9 -9
- data/lib/cocina_display/events/location.rb +9 -1
- data/lib/cocina_display/language.rb +11 -3
- data/lib/cocina_display/license.rb +2 -2
- data/lib/cocina_display/subjects/subject_value.rb +1 -1
- data/lib/cocina_display/title.rb +33 -6
- data/lib/cocina_display/version.rb +1 -1
- data/lib/cocina_display.rb +5 -3
- metadata +5 -5
- data/lib/cocina_display/vocabularies/marc_country.rb +0 -393
- data/lib/cocina_display/vocabularies/marc_relator.rb +0 -318
- data/lib/cocina_display/vocabularies/searchworks_languages.rb +0 -526
@@ -3,8 +3,16 @@
|
|
3
3
|
module CocinaDisplay
|
4
4
|
# A language associated with part or all of a Cocina object.
|
5
5
|
class Language
|
6
|
+
SEARCHWORKS_LANGUAGES_FILE_PATH = CocinaDisplay.root / "config" / "searchworks_languages.yml"
|
7
|
+
|
6
8
|
attr_reader :cocina
|
7
9
|
|
10
|
+
# A hash of language codes to language names recognized by Searchworks.
|
11
|
+
# @return [Hash{String => String}]
|
12
|
+
def self.searchworks_languages
|
13
|
+
@searchworks_languages ||= YAML.safe_load_file(SEARCHWORKS_LANGUAGES_FILE_PATH)
|
14
|
+
end
|
15
|
+
|
8
16
|
# Create a Language object from Cocina structured data.
|
9
17
|
# @param cocina [Hash]
|
10
18
|
def initialize(cocina)
|
@@ -26,7 +34,7 @@ module CocinaDisplay
|
|
26
34
|
# Decoded name of the language based on the code, if present.
|
27
35
|
# @return [String, nil]
|
28
36
|
def decoded_value
|
29
|
-
|
37
|
+
Language.searchworks_languages[code] if searchworks_language?
|
30
38
|
end
|
31
39
|
|
32
40
|
# Display label for this field.
|
@@ -36,10 +44,10 @@ module CocinaDisplay
|
|
36
44
|
end
|
37
45
|
|
38
46
|
# True if the language is recognized by Searchworks.
|
39
|
-
# @see CocinaDisplay::
|
47
|
+
# @see CocinaDisplay::Language.searchworks_languages
|
40
48
|
# @return [Boolean]
|
41
49
|
def searchworks_language?
|
42
|
-
|
50
|
+
Language.searchworks_languages.value?(cocina["value"]) || Language.searchworks_languages.key?(code)
|
43
51
|
end
|
44
52
|
end
|
45
53
|
end
|
@@ -5,7 +5,7 @@ module CocinaDisplay
|
|
5
5
|
# This is the license entity used for translating a license URL into text
|
6
6
|
# for display.
|
7
7
|
class License
|
8
|
-
LICENSE_FILE_PATH =
|
8
|
+
LICENSE_FILE_PATH = CocinaDisplay.root / "config" / "licenses.yml"
|
9
9
|
|
10
10
|
attr_reader :description, :uri
|
11
11
|
|
@@ -15,7 +15,7 @@ module CocinaDisplay
|
|
15
15
|
# A hash of license URLs to their description attributes
|
16
16
|
# @return [Hash{String => Hash{String => String}}]
|
17
17
|
def self.licenses
|
18
|
-
@licenses
|
18
|
+
@licenses ||= YAML.safe_load_file(LICENSE_FILE_PATH)
|
19
19
|
end
|
20
20
|
|
21
21
|
# Initialize a License from a license URL.
|
@@ -26,7 +26,7 @@ module CocinaDisplay
|
|
26
26
|
# @param cocina [Hash] The Cocina structured data for the subject.
|
27
27
|
# @return [Array<Hash>] An array of Cocina hashes, one for each split value
|
28
28
|
def self.split_pre_coordinated_values(cocina, type:)
|
29
|
-
if cocina["value"].is_a?(String) && cocina["value"].include?("--") && !type
|
29
|
+
if cocina["value"].is_a?(String) && cocina["value"].include?("--") && !type&.include?("coordinates")
|
30
30
|
cocina["value"].split("--").map { |v| cocina.merge("value" => v.strip) }
|
31
31
|
else
|
32
32
|
[cocina]
|
data/lib/cocina_display/title.rb
CHANGED
@@ -81,7 +81,7 @@ module CocinaDisplay
|
|
81
81
|
def sort_title
|
82
82
|
return "\u{10FFFF}" unless full_title
|
83
83
|
|
84
|
-
|
84
|
+
sort_title_str
|
85
85
|
.unicode_normalize(:nfd) # Prevent accents being stripped
|
86
86
|
.gsub(/[[:punct:]]*/, "")
|
87
87
|
.gsub(/\W{2,}/, " ") # Collapse whitespace after removing punctuation
|
@@ -99,28 +99,35 @@ module CocinaDisplay
|
|
99
99
|
# Generate the full title by joining all title components with spaces.
|
100
100
|
# @return [String, nil]
|
101
101
|
def full_title_str
|
102
|
-
|
102
|
+
nonsorting_chars_str + sort_title_str
|
103
|
+
end
|
104
|
+
|
105
|
+
# All of the sorting parts of the title joined together with spaces.
|
106
|
+
# @return [String]
|
107
|
+
def sort_title_str
|
108
|
+
Utils.compact_and_join([main_title_str, subtitle_str, parts_str])
|
103
109
|
end
|
104
110
|
|
105
111
|
# Generate the display title by joining all components with punctuation:
|
106
112
|
# - Join main title and subtitle with " : "
|
107
113
|
# - Join part name/number/label with ", "
|
108
114
|
# - Join part string with preceding title with ". "
|
109
|
-
# - Prepend nonsorting characters
|
115
|
+
# - Prepend preformatted nonsorting characters
|
110
116
|
# - Prepend associated names with ". "
|
111
117
|
# @return [String, nil]
|
112
118
|
def display_title_str
|
113
119
|
title_str = Utils.compact_and_join([main_title_str, subtitle_str], delimiter: " : ")
|
114
120
|
title_str = Utils.compact_and_join([title_str, parts_str(delimiter: ", ")], delimiter: ". ")
|
115
|
-
title_str =
|
121
|
+
title_str = nonsorting_chars_str + title_str # pre-formatted padding
|
116
122
|
title_str = Utils.compact_and_join([names_str, title_str], delimiter: ". ") if names_str.present?
|
117
123
|
title_str.presence
|
118
124
|
end
|
119
125
|
|
120
126
|
# All nonsorting characters joined together with padding applied.
|
127
|
+
# Handles languages that do not separate nonsorting characters with spaces.
|
121
128
|
# @return [String, nil]
|
122
129
|
def nonsorting_chars_str
|
123
|
-
Utils.compact_and_join(Array(title_components["nonsorting characters"]))
|
130
|
+
pad_nonsorting(Utils.compact_and_join(Array(title_components["nonsorting characters"])))
|
124
131
|
end
|
125
132
|
|
126
133
|
# The main title component(s), joined together.
|
@@ -182,7 +189,7 @@ module CocinaDisplay
|
|
182
189
|
# Number of nonsorting characters to ignore at the start of the title.
|
183
190
|
# @return [Integer, nil]
|
184
191
|
def nonsorting_char_count
|
185
|
-
Janeway.enum_for("$.note[?(@.type=='nonsorting character count')].value", cocina).first&.to_i
|
192
|
+
Janeway.enum_for("$.note[?(@.type=='nonsorting character count')].value", cocina).first&.to_i
|
186
193
|
end
|
187
194
|
|
188
195
|
# Type-specific label for the title, falling back to a generic "Title".
|
@@ -190,5 +197,25 @@ module CocinaDisplay
|
|
190
197
|
def type_label
|
191
198
|
I18n.t(type&.parameterize&.underscore, scope: "cocina_display.field_label.title", default: :title)
|
192
199
|
end
|
200
|
+
|
201
|
+
private
|
202
|
+
|
203
|
+
# Add or remove padding from nonsorting portion of the title.
|
204
|
+
# @param value [String]
|
205
|
+
# @return [String]
|
206
|
+
def pad_nonsorting(value)
|
207
|
+
case value.strip
|
208
|
+
when /.*-$/, /.*'$/, "ה" # Arabic, French, Hebrew prefixes use no padding
|
209
|
+
value.strip
|
210
|
+
when "" # No nonsorting characters; return empty string
|
211
|
+
""
|
212
|
+
else # Pad to nonsorting char count if set, otherwise add a single space
|
213
|
+
if nonsorting_char_count.present?
|
214
|
+
value.ljust(nonsorting_char_count, " ")
|
215
|
+
else
|
216
|
+
value + " "
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
193
220
|
end
|
194
221
|
end
|
data/lib/cocina_display.rb
CHANGED
@@ -20,13 +20,15 @@ require "zeitwerk"
|
|
20
20
|
loader = Zeitwerk::Loader.new
|
21
21
|
loader.tag = File.basename(__FILE__, ".rb")
|
22
22
|
loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
|
23
|
-
loader.inflector.inflect("searchworks_languages" => "SEARCHWORKS_LANGUAGES",
|
24
|
-
"marc_relator" => "MARC_RELATOR",
|
25
|
-
"marc_country" => "MARC_COUNTRY")
|
26
23
|
loader.push_dir(File.dirname(__FILE__))
|
27
24
|
loader.setup
|
28
25
|
|
29
26
|
module CocinaDisplay
|
30
27
|
# set to an object with a #notify method. This is called if an error is encountered.
|
31
28
|
mattr_accessor :notifier
|
29
|
+
|
30
|
+
# @return [Pathname] Returns the root path of this gem
|
31
|
+
def self.root
|
32
|
+
@root ||= Pathname.new(File.expand_path("..", __dir__))
|
33
|
+
end
|
32
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocina_display
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Budak
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: janeway-jsonpath
|
@@ -227,6 +227,9 @@ files:
|
|
227
227
|
- config/i18n-tasks.yml
|
228
228
|
- config/licenses.yml
|
229
229
|
- config/locales/en.yml
|
230
|
+
- config/marc_countries.yml
|
231
|
+
- config/marc_relators.yml
|
232
|
+
- config/searchworks_languages.yml
|
230
233
|
- lib/cocina_display.rb
|
231
234
|
- lib/cocina_display/cocina_record.rb
|
232
235
|
- lib/cocina_display/concerns.rb
|
@@ -271,9 +274,6 @@ files:
|
|
271
274
|
- lib/cocina_display/title.rb
|
272
275
|
- lib/cocina_display/utils.rb
|
273
276
|
- lib/cocina_display/version.rb
|
274
|
-
- lib/cocina_display/vocabularies/marc_country.rb
|
275
|
-
- lib/cocina_display/vocabularies/marc_relator.rb
|
276
|
-
- lib/cocina_display/vocabularies/searchworks_languages.rb
|
277
277
|
- script/deep_compact.rb
|
278
278
|
- script/find_records.rb
|
279
279
|
- sig/cocina_display.rbs
|
@@ -1,393 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CocinaDisplay
|
4
|
-
module Vocabularies
|
5
|
-
# Map of MARC country codes to country names.
|
6
|
-
# @see http://www.loc.gov/marc/countries/countries_code.html
|
7
|
-
# @note Ported from stanford-mods gem.
|
8
|
-
MARC_COUNTRY = {
|
9
|
-
"aa" => "Albania",
|
10
|
-
"abc" => "Alberta",
|
11
|
-
"ac" => "Ashmore and Cartier Islands", # discontinued
|
12
|
-
"aca" => "Australian Capital Territory",
|
13
|
-
"ae" => "Algeria",
|
14
|
-
"af" => "Afghanistan",
|
15
|
-
"ag" => "Argentina",
|
16
|
-
"ai" => "Armenia (Republic)",
|
17
|
-
"air" => "Armenian S.S.R.", # discontinued
|
18
|
-
"aj" => "Azerbaijan",
|
19
|
-
"ajr" => "Azerbaijan S.S.R.", # discontinued
|
20
|
-
"aku" => "Alaska",
|
21
|
-
"alu" => "Alabama",
|
22
|
-
"am" => "Anguilla",
|
23
|
-
"an" => "Andorra",
|
24
|
-
"ao" => "Angola",
|
25
|
-
"aq" => "Antigua and Barbuda",
|
26
|
-
"aru" => "Arkansas",
|
27
|
-
"as" => "American Samoa",
|
28
|
-
"at" => "Australia",
|
29
|
-
"au" => "Austria",
|
30
|
-
"aw" => "Aruba",
|
31
|
-
"ay" => "Antarctica",
|
32
|
-
"azu" => "Arizona",
|
33
|
-
"ba" => "Bahrain",
|
34
|
-
"bb" => "Barbados",
|
35
|
-
"bcc" => "British Columbia",
|
36
|
-
"bd" => "Burundi",
|
37
|
-
"be" => "Belgium",
|
38
|
-
"bf" => "Bahamas",
|
39
|
-
"bg" => "Bangladesh",
|
40
|
-
"bh" => "Belize",
|
41
|
-
"bi" => "British Indian Ocean Territory",
|
42
|
-
"bl" => "Brazil",
|
43
|
-
"bm" => "Bermuda Islands",
|
44
|
-
"bn" => "Bosnia and Herzegovina",
|
45
|
-
"bo" => "Bolivia",
|
46
|
-
"bp" => "Solomon Islands",
|
47
|
-
"br" => "Burma",
|
48
|
-
"bs" => "Botswana",
|
49
|
-
"bt" => "Bhutan",
|
50
|
-
"bu" => "Bulgaria",
|
51
|
-
"bv" => "Bouvet Island",
|
52
|
-
"bw" => "Belarus",
|
53
|
-
"bwr" => "Byelorussian S.S.R.", # discontinued
|
54
|
-
"bx" => "Brunei",
|
55
|
-
"ca" => "Caribbean Netherlands",
|
56
|
-
"cau" => "California",
|
57
|
-
"cb" => "Cambodia",
|
58
|
-
"cc" => "China",
|
59
|
-
"cd" => "Chad",
|
60
|
-
"ce" => "Sri Lanka",
|
61
|
-
"cf" => "Congo (Brazzaville)",
|
62
|
-
"cg" => "Congo (Democratic Republic)",
|
63
|
-
"ch" => "China (Republic : 1949- )",
|
64
|
-
"ci" => "Croatia",
|
65
|
-
"cj" => "Cayman Islands",
|
66
|
-
"ck" => "Colombia",
|
67
|
-
"cl" => "Chile",
|
68
|
-
"cm" => "Cameroon",
|
69
|
-
"cn" => "Canada", # discontinued
|
70
|
-
"co" => "Curaçao",
|
71
|
-
"cou" => "Colorado",
|
72
|
-
"cp" => "Canton and Enderbury Islands", # discontinued
|
73
|
-
"cq" => "Comoros",
|
74
|
-
"cr" => "Costa Rica",
|
75
|
-
"cs" => "Czechoslovakia", # discontinued
|
76
|
-
"ctu" => "Connecticut",
|
77
|
-
"cu" => "Cuba",
|
78
|
-
"cv" => "Cabo Verde",
|
79
|
-
"cw" => "Cook Islands",
|
80
|
-
"cx" => "Central African Republic",
|
81
|
-
"cy" => "Cyprus",
|
82
|
-
"cz" => "Canal Zone", # discontinued
|
83
|
-
"dcu" => "District of Columbia",
|
84
|
-
"deu" => "Delaware",
|
85
|
-
"dk" => "Denmark",
|
86
|
-
"dm" => "Benin",
|
87
|
-
"dq" => "Dominica",
|
88
|
-
"dr" => "Dominican Republic",
|
89
|
-
"ea" => "Eritrea",
|
90
|
-
"ec" => "Ecuador",
|
91
|
-
"eg" => "Equatorial Guinea",
|
92
|
-
"em" => "Timor-Leste",
|
93
|
-
"enk" => "England",
|
94
|
-
"er" => "Estonia",
|
95
|
-
"err" => "Estonia", # discontinued
|
96
|
-
"es" => "El Salvador",
|
97
|
-
"et" => "Ethiopia",
|
98
|
-
"fa" => "Faroe Islands",
|
99
|
-
"fg" => "French Guiana",
|
100
|
-
"fi" => "Finland",
|
101
|
-
"fj" => "Fiji",
|
102
|
-
"fk" => "Falkland Islands",
|
103
|
-
"flu" => "Florida",
|
104
|
-
"fm" => "Micronesia (Federated States)",
|
105
|
-
"fp" => "French Polynesia",
|
106
|
-
"fr" => "France",
|
107
|
-
"fs" => "Terres australes et antarctiques françaises",
|
108
|
-
"ft" => "Djibouti",
|
109
|
-
"gau" => "Georgia",
|
110
|
-
"gb" => "Kiribati",
|
111
|
-
"gd" => "Grenada",
|
112
|
-
"ge" => "Germany (East)", # discontinued
|
113
|
-
"gg" => "Guernsey",
|
114
|
-
"gh" => "Ghana",
|
115
|
-
"gi" => "Gibraltar",
|
116
|
-
"gl" => "Greenland",
|
117
|
-
"gm" => "Gambia",
|
118
|
-
"gn" => "Gilbert and Ellice Islands", # discontinued
|
119
|
-
"go" => "Gabon",
|
120
|
-
"gp" => "Guadeloupe",
|
121
|
-
"gr" => "Greece",
|
122
|
-
"gs" => "Georgia (Republic)",
|
123
|
-
"gsr" => "Georgian S.S.R.", # discontinued
|
124
|
-
"gt" => "Guatemala",
|
125
|
-
"gu" => "Guam",
|
126
|
-
"gv" => "Guinea",
|
127
|
-
"gw" => "Germany",
|
128
|
-
"gy" => "Guyana",
|
129
|
-
"gz" => "Gaza Strip",
|
130
|
-
"hiu" => "Hawaii",
|
131
|
-
"hk" => "Hong Kong", # discontinued
|
132
|
-
"hm" => "Heard and McDonald Islands",
|
133
|
-
"ho" => "Honduras",
|
134
|
-
"ht" => "Haiti",
|
135
|
-
"hu" => "Hungary",
|
136
|
-
"iau" => "Iowa",
|
137
|
-
"ic" => "Iceland",
|
138
|
-
"idu" => "Idaho",
|
139
|
-
"ie" => "Ireland",
|
140
|
-
"ii" => "India",
|
141
|
-
"ilu" => "Illinois",
|
142
|
-
"im" => "Isle of Man",
|
143
|
-
"inu" => "Indiana",
|
144
|
-
"io" => "Indonesia",
|
145
|
-
"iq" => "Iraq",
|
146
|
-
"ir" => "Iran",
|
147
|
-
"is" => "Israel",
|
148
|
-
"it" => "Italy",
|
149
|
-
"iu" => "Israel-Syria Demilitarized Zones", # discontinued
|
150
|
-
"iv" => "Côte d'Ivoire",
|
151
|
-
"iw" => "Israel-Jordan Demilitarized Zones", # discontinued
|
152
|
-
"iy" => "Iraq-Saudi Arabia Neutral Zone",
|
153
|
-
"ja" => "Japan",
|
154
|
-
"je" => "Jersey",
|
155
|
-
"ji" => "Johnston Atoll",
|
156
|
-
"jm" => "Jamaica",
|
157
|
-
"jn" => "Jan Mayen", # discontinued
|
158
|
-
"jo" => "Jordan",
|
159
|
-
"ke" => "Kenya",
|
160
|
-
"kg" => "Kyrgyzstan",
|
161
|
-
"kgr" => "Kirghiz S.S.R.", # discontinued
|
162
|
-
"kn" => "Korea (North)",
|
163
|
-
"ko" => "Korea (South)",
|
164
|
-
"ksu" => "Kansas",
|
165
|
-
"ku" => "Kuwait",
|
166
|
-
"kv" => "Kosovo",
|
167
|
-
"kyu" => "Kentucky",
|
168
|
-
"kz" => "Kazakhstan",
|
169
|
-
"kzr" => "Kazakh S.S.R.", # discontinued
|
170
|
-
"lau" => "Louisiana",
|
171
|
-
"lb" => "Liberia",
|
172
|
-
"le" => "Lebanon",
|
173
|
-
"lh" => "Liechtenstein",
|
174
|
-
"li" => "Lithuania",
|
175
|
-
"lir" => "Lithuania", # discontinued
|
176
|
-
"ln" => "Central and Southern Line Islands", # discontinued
|
177
|
-
"lo" => "Lesotho",
|
178
|
-
"ls" => "Laos",
|
179
|
-
"lu" => "Luxembourg",
|
180
|
-
"lv" => "Latvia",
|
181
|
-
"lvr" => "Latvia", # discontinued
|
182
|
-
"ly" => "Libya",
|
183
|
-
"mau" => "Massachusetts",
|
184
|
-
"mbc" => "Manitoba",
|
185
|
-
"mc" => "Monaco",
|
186
|
-
"mdu" => "Maryland",
|
187
|
-
"meu" => "Maine",
|
188
|
-
"mf" => "Mauritius",
|
189
|
-
"mg" => "Madagascar",
|
190
|
-
"mh" => "Macao", # discontinued
|
191
|
-
"miu" => "Michigan",
|
192
|
-
"mj" => "Montserrat",
|
193
|
-
"mk" => "Oman",
|
194
|
-
"ml" => "Mali",
|
195
|
-
"mm" => "Malta",
|
196
|
-
"mnu" => "Minnesota",
|
197
|
-
"mo" => "Montenegro",
|
198
|
-
"mou" => "Missouri",
|
199
|
-
"mp" => "Mongolia",
|
200
|
-
"mq" => "Martinique",
|
201
|
-
"mr" => "Morocco",
|
202
|
-
"msu" => "Mississippi",
|
203
|
-
"mtu" => "Montana",
|
204
|
-
"mu" => "Mauritania",
|
205
|
-
"mv" => "Moldova",
|
206
|
-
"mvr" => "Moldavian S.S.R.", # discontinued
|
207
|
-
"mw" => "Malawi",
|
208
|
-
"mx" => "Mexico",
|
209
|
-
"my" => "Malaysia",
|
210
|
-
"mz" => "Mozambique",
|
211
|
-
"na" => "Netherlands Antilles", # discontinued
|
212
|
-
"nbu" => "Nebraska",
|
213
|
-
"ncu" => "North Carolina",
|
214
|
-
"ndu" => "North Dakota",
|
215
|
-
"ne" => "Netherlands",
|
216
|
-
"nfc" => "Newfoundland and Labrador",
|
217
|
-
"ng" => "Niger",
|
218
|
-
"nhu" => "New Hampshire",
|
219
|
-
"nik" => "Northern Ireland",
|
220
|
-
"nju" => "New Jersey",
|
221
|
-
"nkc" => "New Brunswick",
|
222
|
-
"nl" => "New Caledonia",
|
223
|
-
"nm" => "Northern Mariana Islands", # discontinued
|
224
|
-
"nmu" => "New Mexico",
|
225
|
-
"nn" => "Vanuatu",
|
226
|
-
"no" => "Norway",
|
227
|
-
"np" => "Nepal",
|
228
|
-
"nq" => "Nicaragua",
|
229
|
-
"nr" => "Nigeria",
|
230
|
-
"nsc" => "Nova Scotia",
|
231
|
-
"ntc" => "Northwest Territories",
|
232
|
-
"nu" => "Nauru",
|
233
|
-
"nuc" => "Nunavut",
|
234
|
-
"nvu" => "Nevada",
|
235
|
-
"nw" => "Northern Mariana Islands",
|
236
|
-
"nx" => "Norfolk Island",
|
237
|
-
"nyu" => "New York (State)",
|
238
|
-
"nz" => "New Zealand",
|
239
|
-
"ohu" => "Ohio",
|
240
|
-
"oku" => "Oklahoma",
|
241
|
-
"onc" => "Ontario",
|
242
|
-
"oru" => "Oregon",
|
243
|
-
"ot" => "Mayotte",
|
244
|
-
"pau" => "Pennsylvania",
|
245
|
-
"pc" => "Pitcairn Island",
|
246
|
-
"pe" => "Peru",
|
247
|
-
"pf" => "Paracel Islands",
|
248
|
-
"pg" => "Guinea-Bissau",
|
249
|
-
"ph" => "Philippines",
|
250
|
-
"pic" => "Prince Edward Island",
|
251
|
-
"pk" => "Pakistan",
|
252
|
-
"pl" => "Poland",
|
253
|
-
"pn" => "Panama",
|
254
|
-
"po" => "Portugal",
|
255
|
-
"pp" => "Papua New Guinea",
|
256
|
-
"pr" => "Puerto Rico",
|
257
|
-
"pt" => "Portuguese Timor", # discontinued
|
258
|
-
"pw" => "Palau",
|
259
|
-
"py" => "Paraguay",
|
260
|
-
"qa" => "Qatar",
|
261
|
-
"qea" => "Queensland",
|
262
|
-
"quc" => "Québec (Province)",
|
263
|
-
"rb" => "Serbia",
|
264
|
-
"re" => "Réunion",
|
265
|
-
"rh" => "Zimbabwe",
|
266
|
-
"riu" => "Rhode Island",
|
267
|
-
"rm" => "Romania",
|
268
|
-
"ru" => "Russia (Federation)",
|
269
|
-
"rur" => "Russian S.F.S.R.", # discontinued
|
270
|
-
"rw" => "Rwanda",
|
271
|
-
"ry" => "Ryukyu Islands, Southern", # discontinued
|
272
|
-
"sa" => "South Africa",
|
273
|
-
"sb" => "Svalbard", # discontinued
|
274
|
-
"sc" => "Saint-Barthélemy",
|
275
|
-
"scu" => "South Carolina",
|
276
|
-
"sd" => "South Sudan",
|
277
|
-
"sdu" => "South Dakota",
|
278
|
-
"se" => "Seychelles",
|
279
|
-
"sf" => "Sao Tome and Principe",
|
280
|
-
"sg" => "Senegal",
|
281
|
-
"sh" => "Spanish North Africa",
|
282
|
-
"si" => "Singapore",
|
283
|
-
"sj" => "Sudan",
|
284
|
-
"sk" => "Sikkim", # discontinued
|
285
|
-
"sl" => "Sierra Leone",
|
286
|
-
"sm" => "San Marino",
|
287
|
-
"sn" => "Sint Maarten",
|
288
|
-
"snc" => "Saskatchewan",
|
289
|
-
"so" => "Somalia",
|
290
|
-
"sp" => "Spain",
|
291
|
-
"sq" => "Eswatini",
|
292
|
-
"sr" => "Surinam",
|
293
|
-
"ss" => "Western Sahara",
|
294
|
-
"st" => "Saint-Martin",
|
295
|
-
"stk" => "Scotland",
|
296
|
-
"su" => "Saudi Arabia",
|
297
|
-
"sv" => "Swan Islands", # discontinued
|
298
|
-
"sw" => "Sweden",
|
299
|
-
"sx" => "Namibia",
|
300
|
-
"sy" => "Syria",
|
301
|
-
"sz" => "Switzerland",
|
302
|
-
"ta" => "Tajikistan",
|
303
|
-
"tar" => "Tajik S.S.R.", # discontinued
|
304
|
-
"tc" => "Turks and Caicos Islands",
|
305
|
-
"tg" => "Togo",
|
306
|
-
"th" => "Thailand",
|
307
|
-
"ti" => "Tunisia",
|
308
|
-
"tk" => "Turkmenistan",
|
309
|
-
"tkr" => "Turkmen S.S.R.", # discontinued
|
310
|
-
"tl" => "Tokelau",
|
311
|
-
"tma" => "Tasmania",
|
312
|
-
"tnu" => "Tennessee",
|
313
|
-
"to" => "Tonga",
|
314
|
-
"tr" => "Trinidad and Tobago",
|
315
|
-
"ts" => "United Arab Emirates",
|
316
|
-
"tt" => "Trust Territory of the Pacific Islands", # discontinued
|
317
|
-
"tu" => "Turkey",
|
318
|
-
"tv" => "Tuvalu",
|
319
|
-
"txu" => "Texas",
|
320
|
-
"tz" => "Tanzania",
|
321
|
-
"ua" => "Egypt",
|
322
|
-
"uc" => "United States Misc. Caribbean Islands",
|
323
|
-
"ug" => "Uganda",
|
324
|
-
"ui" => "United Kingdom Misc. Islands", # discontinued
|
325
|
-
"uik" => "United Kingdom Misc. Islands",
|
326
|
-
"uk" => "United Kingdom", # discontinued
|
327
|
-
"un" => "Ukraine",
|
328
|
-
"unr" => "Ukraine", # discontinued
|
329
|
-
"up" => "United States Misc. Pacific Islands",
|
330
|
-
"ur" => "Soviet Union", # discontinued
|
331
|
-
"us" => "United States", # discontinued
|
332
|
-
"utu" => "Utah",
|
333
|
-
"uv" => "Burkina Faso",
|
334
|
-
"uy" => "Uruguay",
|
335
|
-
"uz" => "Uzbekistan",
|
336
|
-
"uzr" => "Uzbek S.S.R.", # discontinued
|
337
|
-
"vau" => "Virginia",
|
338
|
-
"vb" => "British Virgin Islands",
|
339
|
-
"vc" => "Vatican City",
|
340
|
-
"ve" => "Venezuela",
|
341
|
-
"vi" => "Virgin Islands of the United States",
|
342
|
-
"vm" => "Vietnam",
|
343
|
-
"vn" => "Vietnam, North", # discontinued
|
344
|
-
"vp" => "Various places",
|
345
|
-
"vra" => "Victoria",
|
346
|
-
"vs" => "Vietnam, South", # discontinued
|
347
|
-
"vtu" => "Vermont",
|
348
|
-
"wau" => "Washington (State)",
|
349
|
-
"wb" => "West Berlin", # discontinued
|
350
|
-
"wea" => "Western Australia",
|
351
|
-
"wf" => "Wallis and Futuna",
|
352
|
-
"wiu" => "Wisconsin",
|
353
|
-
"wj" => "West Bank of the Jordan River",
|
354
|
-
"wk" => "Wake Island",
|
355
|
-
"wlk" => "Wales",
|
356
|
-
"ws" => "Samoa",
|
357
|
-
"wvu" => "West Virginia",
|
358
|
-
"wyu" => "Wyoming",
|
359
|
-
"xa" => "Christmas Island (Indian Ocean)",
|
360
|
-
"xb" => "Cocos (Keeling) Islands",
|
361
|
-
"xc" => "Maldives",
|
362
|
-
"xd" => "Saint Kitts-Nevis",
|
363
|
-
"xe" => "Marshall Islands",
|
364
|
-
"xf" => "Midway Islands",
|
365
|
-
"xga" => "Coral Sea Islands Territory",
|
366
|
-
"xh" => "Niue",
|
367
|
-
"xi" => "Saint Kitts-Nevis-Anguilla", # discontinued
|
368
|
-
"xj" => "Saint Helena",
|
369
|
-
"xk" => "Saint Lucia",
|
370
|
-
"xl" => "Saint Pierre and Miquelon",
|
371
|
-
"xm" => "Saint Vincent and the Grenadines",
|
372
|
-
"xn" => "North Macedonia",
|
373
|
-
"xna" => "New South Wales",
|
374
|
-
"xo" => "Slovakia",
|
375
|
-
"xoa" => "Northern Territory",
|
376
|
-
"xp" => "Spratly Island",
|
377
|
-
"xr" => "Czech Republic",
|
378
|
-
"xra" => "South Australia",
|
379
|
-
"xs" => "South Georgia and the South Sandwich Islands",
|
380
|
-
"xv" => "Slovenia",
|
381
|
-
"xx" => "No place, unknown, or undetermined",
|
382
|
-
"xxc" => "Canada",
|
383
|
-
"xxk" => "United Kingdom",
|
384
|
-
"xxr" => "Soviet Union", # discontinued
|
385
|
-
"xxu" => "United States",
|
386
|
-
"ye" => "Yemen",
|
387
|
-
"ykc" => "Yukon Territory",
|
388
|
-
"ys" => "Yemen (People's Democratic Republic)", # discontinued
|
389
|
-
"yu" => "Serbia and Montenegro", # discontinued
|
390
|
-
"za" => "Zambia"
|
391
|
-
}.freeze
|
392
|
-
end
|
393
|
-
end
|