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.
@@ -0,0 +1,520 @@
1
+ # Map of language codes to language names used in Searchworks, ported from stanford-mods gem.
2
+ # See: https://github.com/solrmarc/stanford-solr-marc/blob/master/stanford-sw/translation_maps/language_map.properties
3
+
4
+ aaa: Afar
5
+ abk: Abkhaz
6
+ ace: Achinese
7
+ ach: Acoli
8
+ ada: Adangme
9
+ ady: Adygei
10
+ afa: Afroasiatic (Other)
11
+ afh: Afrihili (Artificial language)
12
+ afr: Afrikaans
13
+ ain: Ainu
14
+ ajm: Aljamia
15
+ aka: Akan
16
+ akk: Akkadian
17
+ alb: Albanian
18
+ ale: Aleut
19
+ alg: Algonquian (Other)
20
+ alt: Altai
21
+ amh: Amharic
22
+ ang: English, Old (ca. 450-1100)
23
+ anp: Angika
24
+ apa: Apache languages
25
+ ara: Arabic
26
+ arc: Aramaic
27
+ arg: Aragonese Spanish
28
+ arm: Armenian
29
+ arn: Mapuche
30
+ arp: Arapaho
31
+ art: Artificial (Other)
32
+ arw: Arawak
33
+ ase: American Sign Language
34
+ asm: Assamese
35
+ ast: Bable
36
+ ath: Athapascan (Other)
37
+ aus: Australian languages
38
+ ava: Avaric
39
+ ave: Avestan
40
+ awa: Awadhi
41
+ aym: Aymara
42
+ aze: Azerbaijani
43
+ bad: Banda
44
+ bai: Bamileke languages
45
+ bak: Bashkir
46
+ bal: Baluchi
47
+ bam: Bambara
48
+ ban: Balinese
49
+ baq: Basque
50
+ bas: Basa
51
+ bat: Baltic (Other)
52
+ bej: Beja
53
+ bel: Belarusian
54
+ bem: Bemba
55
+ ben: Bengali
56
+ ber: Berber (Other)
57
+ bho: Bhojpuri
58
+ bih: Bihari
59
+ bik: Bikol
60
+ bin: Edo
61
+ bis: Bislama
62
+ bla: Siksika
63
+ bnt: Bantu (Other)
64
+ bos: Bosnian
65
+ bra: Braj
66
+ bre: Breton
67
+ btk: Batak
68
+ bua: Buriat
69
+ bug: Bugis
70
+ bul: Bulgarian
71
+ bur: Burmese
72
+ byn: Bilin
73
+ cad: Caddo
74
+ cai: Central American Indian (Other)
75
+ cam: Khmer
76
+ car: Carib
77
+ cat: Catalan
78
+ cau: Caucasian (Other)
79
+ ceb: Cebuano
80
+ cel: Celtic (Other)
81
+ cha: Chamorro
82
+ chb: Chibcha
83
+ che: Chechen
84
+ chg: Chagatai
85
+ chi: Chinese
86
+ chk: Truk
87
+ chm: Mari
88
+ chn: Chinook jargon
89
+ cho: Choctaw
90
+ chp: Chipewyan
91
+ chr: Cherokee
92
+ chu: Church Slavic
93
+ chv: Chuvash
94
+ chy: Cheyenne
95
+ cmc: Chamic languages
96
+ cop: Coptic
97
+ cor: Cornish
98
+ cos: Corsican
99
+ cpe: Creoles and Pidgins, English-based (Other)
100
+ cpf: Creoles and Pidgins, French-based (Other)
101
+ cpp: Creoles and Pidgins, Portuguese-based (Other)
102
+ cre: Cree
103
+ crh: Crimean Tatar
104
+ crp: Creoles and Pidgins (Other)
105
+ csb: Kashubian
106
+ cus: Cushitic (Other)
107
+ cze: Czech
108
+ dak: Dakota
109
+ dan: Danish
110
+ dar: Dargwa
111
+ day: Dayak
112
+ del: Delaware
113
+ den: Slave
114
+ dgr: Dogrib
115
+ din: Dinka
116
+ div: Divehi
117
+ doi: Dogri
118
+ dra: Dravidian (Other)
119
+ dsb: Lower Sorbian
120
+ dua: Duala
121
+ dum: Dutch, Middle (ca. 1050-1350)
122
+ dut: Dutch
123
+ dyu: Dyula
124
+ dzo: Dzongkha
125
+ efi: Efik
126
+ egy: Egyptian
127
+ egy-Egyd: Egyptian, Demotic
128
+ eka: Ekajuk
129
+ elx: Elamite
130
+ eng: English
131
+ enm: English, Middle (1100-1500)
132
+ epo: Esperanto
133
+ esk: Eskimo languages
134
+ esp: Esperanto
135
+ est: Estonian
136
+ eth: Ethiopic
137
+ ewe: Ewe
138
+ ewo: Ewondo
139
+ fan: Fang
140
+ fao: Faroese
141
+ far: Faroese
142
+ fat: Fanti
143
+ fij: Fijian
144
+ fil: Filipino
145
+ fin: Finnish
146
+ fiu: Finno-Ugrian (Other)
147
+ fon: Fon
148
+ fre: French
149
+ fri: Frisian
150
+ frm: French, Middle (ca. 1400-1600)
151
+ fro: French, Old (ca. 842-1400)
152
+ frr: North Frisian
153
+ frs: East Frisian
154
+ fry: Frisian
155
+ ful: Fula
156
+ fur: Friulian
157
+ gaa: Ga
158
+ gae: Scottish Gaelic
159
+ gag: Galician
160
+ gal: Oromo
161
+ gay: Gayo
162
+ gba: Gbaya
163
+ gem: Germanic (Other)
164
+ geo: Georgian
165
+ ger: German
166
+ gez: Ethiopic
167
+ gil: Gilbertese
168
+ gla: Scottish Gaelic
169
+ gle: Irish
170
+ glg: Galician
171
+ glv: Manx
172
+ gmh: German, Middle High (ca. 1050-1500)
173
+ goh: German, Old High (ca. 750-1050)
174
+ gon: Gondi
175
+ gor: Gorontalo
176
+ got: Gothic
177
+ grb: Grebo
178
+ grc: Greek, Ancient (to 1453)
179
+ gre: Greek, Modern (1453- )
180
+ grn: Guarani
181
+ gsw: Swiss German
182
+ gua: Guarani
183
+ guj: Gujarati
184
+ gwi: Gwich'in
185
+ hai: Haida
186
+ hat: Haitian French Creole
187
+ hau: Hausa
188
+ haw: Hawaiian
189
+ heb: Hebrew
190
+ her: Herero
191
+ hil: Hiligaynon
192
+ him: Himachali
193
+ hin: Hindi
194
+ hit: Hittite
195
+ hmn: Hmong
196
+ hmo: Hiri Motu
197
+ hrv: Croatian
198
+ hsb: Upper Sorbian
199
+ hun: Hungarian
200
+ hup: Hupa
201
+ iba: Iban
202
+ ibo: Igbo
203
+ ice: Icelandic
204
+ ido: Ido
205
+ iii: Sichuan Yi
206
+ ijo: Ijo
207
+ iku: Inuktitut
208
+ ile: Interlingue
209
+ ilo: Iloko
210
+ ina: Interlingua (International Auxiliary Language Association)
211
+ inc: Indic (Other)
212
+ ind: Indonesian
213
+ ine: Indo-European (Other)
214
+ inh: Ingush
215
+ int: Interlingua (International Auxiliary Language Association)
216
+ ipk: Inupiaq
217
+ ira: Iranian (Other)
218
+ iri: Irish
219
+ iro: Iroquoian (Other)
220
+ ita: Italian
221
+ jav: Javanese
222
+ jbo: Lojban (Artificial language)
223
+ jpn: Japanese
224
+ jpr: Judeo-Persian
225
+ jrb: Judeo-Arabic
226
+ kaa: Kara-Kalpak
227
+ kab: Kabyle
228
+ kac: Kachin
229
+ kal: Kalatdlisut
230
+ kam: Kamba
231
+ kan: Kannada
232
+ kar: Karen
233
+ kas: Kashmiri
234
+ kau: Kanuri
235
+ kaw: Kawi
236
+ kaz: Kazakh
237
+ kbd: Kabardian
238
+ kha: Khasi
239
+ khi: Khoisan (Other)
240
+ khm: Khmer
241
+ kho: Khotanese
242
+ kik: Kikuyu
243
+ kin: Kinyarwanda
244
+ kir: Kyrgyz
245
+ kmb: Kimbundu
246
+ kok: Konkani
247
+ kom: Komi
248
+ kon: Kongo
249
+ kor: Korean
250
+ kos: Kusaie
251
+ kpe: Kpelle
252
+ krc: Karachay-Balkar
253
+ krl: Karelian
254
+ kro: Kru
255
+ kru: Kurukh
256
+ kua: Kuanyama
257
+ kum: Kumyk
258
+ kur: Kurdish
259
+ kus: Kusaie
260
+ kut: Kutenai
261
+ lad: Ladino
262
+ lah: Lahnda
263
+ lam: Lamba
264
+ lan: Occitan (post-1500)
265
+ lao: Lao
266
+ lap: Sami
267
+ lat: Latin
268
+ lav: Latvian
269
+ lez: Lezgian
270
+ lim: Limburgish
271
+ lin: Lingala
272
+ lit: Lithuanian
273
+ lol: Mongo-Nkundu
274
+ loz: Lozi
275
+ ltz: Letzeburgesch
276
+ lua: Luba-Lulua
277
+ lub: Luba-Katanga
278
+ lug: Ganda
279
+ lui: Luiseno
280
+ lun: Lunda
281
+ luo: Luo (Kenya and Tanzania)
282
+ lus: Lushai
283
+ mac: Macedonian
284
+ mad: Madurese
285
+ mag: Magahi
286
+ mah: Marshallese
287
+ mai: Maithili
288
+ mak: Makasar
289
+ mal: Malayalam
290
+ man: Mandingo
291
+ mao: Maori
292
+ map: Austronesian (Other)
293
+ mar: Marathi
294
+ mas: Masai
295
+ max: Manx
296
+ may: Malay
297
+ mdf: Moksha
298
+ mdr: Mandar
299
+ men: Mende
300
+ mga: Irish, Middle (ca. 1100-1550)
301
+ mic: Micmac
302
+ min: Minangkabau
303
+ # mis: Miscellaneous languages
304
+ mkh: Mon-Khmer (Other)
305
+ mla: Malagasy
306
+ mlg: Malagasy
307
+ mlt: Maltese
308
+ mnc: Manchu
309
+ mni: Manipuri
310
+ mno: Manobo languages
311
+ moh: Mohawk
312
+ mol: Moldavian
313
+ mon: Mongolian
314
+ mos: Moore
315
+ # mul: Multiple languages
316
+ mun: Munda (Other)
317
+ mus: Creek
318
+ mwl: Mirandese
319
+ mwr: Marwari
320
+ myn: Mayan languages
321
+ myv: Erzya
322
+ nah: Nahuatl
323
+ nai: North American Indian (Other)
324
+ nap: Neapolitan Italian
325
+ nau: Nauru
326
+ nav: Navajo
327
+ nbl: Ndebele (South Africa)
328
+ nde: Ndebele (Zimbabwe)
329
+ ndo: Ndonga
330
+ nds: Low German
331
+ nep: Nepali
332
+ new: Newari
333
+ nia: Nias
334
+ nic: Niger-Kordofanian (Other)
335
+ niu: Niuean
336
+ nno: Norwegian (Nynorsk)
337
+ nob: Norwegian (Bokmal)
338
+ nog: Nogai
339
+ non: Old Norse
340
+ nor: Norwegian
341
+ nqo: N'Ko
342
+ nso: Northern Sotho
343
+ nub: Nubian languages
344
+ nwc: Newari, Old
345
+ nya: Nyanja
346
+ nym: Nyamwezi
347
+ nyn: Nyankole
348
+ nyo: Nyoro
349
+ nzi: Nzima
350
+ oci: Occitan (post-1500)
351
+ oji: Ojibwa
352
+ ori: Oriya
353
+ orm: Oromo
354
+ osa: Osage
355
+ oss: Ossetic
356
+ ota: Turkish, Ottoman
357
+ oto: Otomian languages
358
+ paa: Papuan (Other)
359
+ pag: Pangasinan
360
+ pal: Pahlavi
361
+ pam: Pampanga
362
+ pan: Panjabi
363
+ pap: Papiamento
364
+ pau: Palauan
365
+ peo: Old Persian (ca. 600-400 B.C.)
366
+ per: Persian
367
+ phi: Philippine (Other)
368
+ phn: Phoenician
369
+ pli: Pali
370
+ pol: Polish
371
+ pon: Ponape
372
+ por: Portuguese
373
+ pra: Prakrit languages
374
+ pro: Provencal (to 1500)
375
+ pus: Pushto
376
+ que: Quechua
377
+ raj: Rajasthani
378
+ rap: Rapanui
379
+ rar: Rarotongan
380
+ roa: Romance (Other)
381
+ roh: Raeto-Romance
382
+ rom: Romani
383
+ rum: Romanian
384
+ run: Rundi
385
+ rup: Aromanian
386
+ rus: Russian
387
+ sad: Sandawe
388
+ sag: Sango (Ubangi Creole)
389
+ sah: Yakut
390
+ sai: South American Indian (Other)
391
+ sal: Salishan languages
392
+ sam: Samaritan Aramaic
393
+ san: Sanskrit
394
+ sao: Samoan
395
+ sas: Sasak
396
+ sat: Santali
397
+ scc: Serbian
398
+ scn: Sicilian Italian
399
+ sco: Scots
400
+ scr: Croatian
401
+ sel: Selkup
402
+ sem: Semitic (Other)
403
+ sga: Irish, Old (to 1100)
404
+ sgn: Sign languages
405
+ shn: Shan
406
+ sho: Shona
407
+ sid: Sidamo
408
+ sin: Sinhalese
409
+ sio: Siouan (Other)
410
+ sit: Sino-Tibetan (Other)
411
+ sla: Slavic (Other)
412
+ slo: Slovak
413
+ slv: Slovenian
414
+ sma: Southern Sami
415
+ sme: Northern Sami
416
+ smi: Sami
417
+ smj: Lule Sami
418
+ smn: Inari Sami
419
+ smo: Samoan
420
+ sms: Skolt Sami
421
+ sna: Shona
422
+ snd: Sindhi
423
+ snh: Sinhalese
424
+ snk: Soninke
425
+ sog: Sogdian
426
+ som: Somali
427
+ son: Songhai
428
+ sot: Sotho
429
+ spa: Spanish
430
+ srd: Sardinian
431
+ srn: Sranan
432
+ srp: Serbian
433
+ srr: Serer
434
+ ssa: Nilo-Saharan (Other)
435
+ sso: Sotho
436
+ ssw: Swazi
437
+ suk: Sukuma
438
+ sun: Sundanese
439
+ sus: Susu
440
+ sux: Sumerian
441
+ swa: Swahili
442
+ swe: Swedish
443
+ swz: Swazi
444
+ syc: Syriac
445
+ syr: Syriac, Modern
446
+ tag: Tagalog
447
+ tah: Tahitian
448
+ tai: Tai (Other)
449
+ taj: Tajik
450
+ tam: Tamil
451
+ tar: Tatar
452
+ tat: Tatar
453
+ tel: Telugu
454
+ tem: Temne
455
+ ter: Terena
456
+ tet: Tetum
457
+ tgk: Tajik
458
+ tgl: Tagalog
459
+ tha: Thai
460
+ tib: Tibetan
461
+ tig: Tigre
462
+ tir: Tigrinya
463
+ tiv: Tiv
464
+ tkl: Tokelauan
465
+ tlh: Klingon (Artificial language)
466
+ tli: Tlingit
467
+ tmh: Tamashek
468
+ tog: Tonga (Nyasa)
469
+ ton: Tongan
470
+ tpi: Tok Pisin
471
+ tru: Truk
472
+ tsi: Tsimshian
473
+ tsn: Tswana
474
+ tso: Tsonga
475
+ tsw: Tswana
476
+ tuk: Turkmen
477
+ tum: Tumbuka
478
+ tup: Tupi languages
479
+ tur: Turkish
480
+ tut: Altaic (Other)
481
+ tvl: Tuvaluan
482
+ twi: Twi
483
+ tyv: Tuvinian
484
+ udm: Udmurt
485
+ uga: Ugaritic
486
+ uig: Uighur
487
+ ukr: Ukrainian
488
+ umb: Umbundu
489
+ # und: Undetermined
490
+ urd: Urdu
491
+ uzb: Uzbek
492
+ vai: Vai
493
+ ven: Venda
494
+ vie: Vietnamese
495
+ vol: Volapuk
496
+ vot: Votic
497
+ wak: Wakashan languages
498
+ wal: Walamo
499
+ war: Waray
500
+ was: Washo
501
+ wel: Welsh
502
+ wen: Sorbian languages
503
+ wln: Walloon
504
+ wol: Wolof
505
+ xal: Kalmyk
506
+ xho: Xhosa
507
+ yao: Yao (Africa)
508
+ yap: Yapese
509
+ yid: Yiddish
510
+ yor: Yoruba
511
+ ypk: Yupik languages
512
+ zap: Zapotec
513
+ zbl: Blissymbolics
514
+ zen: Zenaga
515
+ zha: Zhuang
516
+ znd: Zande
517
+ zul: Zulu
518
+ zun: Zuni
519
+ # zxx: null
520
+ zza: Zaza
@@ -20,11 +20,12 @@ module CocinaDisplay
20
20
  # Fetch a public Cocina document from PURL and create a CocinaRecord.
21
21
  # @note This is intended to be used in development or testing only.
22
22
  # @param druid [String] The bare DRUID of the object to fetch.
23
+ # @param purl_url [String] The base url for the purl service.
23
24
  # @param deep_compact [Boolean] If true, compact the JSON to remove blank values.
24
25
  # @return [CocinaDisplay::CocinaRecord]
25
26
  # :nocov:
26
- def self.fetch(druid, deep_compact: true)
27
- from_json(Net::HTTP.get(URI("https://purl.stanford.edu/#{druid}.json")), deep_compact: deep_compact)
27
+ def self.fetch(druid, deep_compact: true, purl_url: "https://purl.stanford.edu")
28
+ from_json(Net::HTTP.get(URI("#{purl_url}/#{druid}.json")), deep_compact: deep_compact)
28
29
  end
29
30
  # :nocov:
30
31
 
@@ -21,7 +21,7 @@ module CocinaDisplay
21
21
  # Exhibits and EarthWorks handle useAndReproductionStatement like descriptive metadata.
22
22
  # @return [Array<CocinaDisplay::DisplayData>]
23
23
  def use_and_reproduction_display_data
24
- CocinaDisplay::DisplayData.from_string(use_and_reproduction,
24
+ CocinaDisplay::DisplayData.from_strings([use_and_reproduction],
25
25
  label: I18n.t("cocina_display.field_label.use_and_reproduction"))
26
26
  end
27
27
 
@@ -29,12 +29,12 @@ module CocinaDisplay
29
29
  # Exhibits and EarthWorks handle copyright like descriptive metadata.
30
30
  # @return [Array<CocinaDisplay::DisplayData>]
31
31
  def copyright_display_data
32
- CocinaDisplay::DisplayData.from_string(copyright,
32
+ CocinaDisplay::DisplayData.from_strings([copyright],
33
33
  label: I18n.t("cocina_display.field_label.copyright"))
34
34
  end
35
35
 
36
36
  def license_display_data
37
- CocinaDisplay::DisplayData.from_string(license_description,
37
+ CocinaDisplay::DisplayData.from_strings([license_description],
38
38
  label: I18n.t("cocina_display.field_label.license"))
39
39
  end
40
40
 
@@ -71,7 +71,7 @@ module CocinaDisplay
71
71
  def purls
72
72
  return [] unless purl_url.present?
73
73
 
74
- CocinaDisplay::DisplayData.descriptive_values_from_string(purl_url, label: I18n.t("cocina_display.field_label.purl"))
74
+ CocinaDisplay::DisplayData.descriptive_values_from_strings([purl_url], label: I18n.t("cocina_display.field_label.purl"))
75
75
  end
76
76
  end
77
77
  end
@@ -26,9 +26,6 @@ module CocinaDisplay
26
26
  # @example
27
27
  # record.doi #=> "10.25740/ppax-bf07"
28
28
  def doi
29
- doi_id = path("$.identification.doi").first
30
- return URI(doi_id).path.delete_prefix("/") if doi_id.present?
31
-
32
29
  identifiers.find(&:doi?)&.identifier
33
30
  end
34
31
 
@@ -66,10 +63,10 @@ module CocinaDisplay
66
63
  folio_hrid || bare_druid
67
64
  end
68
65
 
69
- # Identifier objects extracted from the Cocina descriptive metadata.
66
+ # Identifier objects extracted from the Cocina metadata.
70
67
  # @return [Array<Identifier>]
71
68
  def identifiers
72
- @identifiers ||= path("$.description.identifier[*]").map { |id| Identifier.new(id) }
69
+ @identifiers ||= path("$.description.identifier[*]").map { |id| Identifier.new(id) } + Array(doi_from_identification)
73
70
  end
74
71
 
75
72
  # Labelled display data for identifiers.
@@ -77,6 +74,18 @@ module CocinaDisplay
77
74
  def identifier_display_data
78
75
  CocinaDisplay::DisplayData.from_objects(identifiers)
79
76
  end
77
+
78
+ private
79
+
80
+ # Synthetic Identifier object for a DOI in the identification block.
81
+ # @return [Array<Identifier>]
82
+ def doi_from_identification
83
+ id = path("$.identification.doi").first
84
+ return if id.blank?
85
+
86
+ value_key = id.start_with?("http") ? "uri" : "value"
87
+ Identifier.new({value_key => id, "type" => "doi"})
88
+ end
80
89
  end
81
90
  end
82
91
  end
@@ -4,8 +4,16 @@ module CocinaDisplay
4
4
  module Contributors
5
5
  # A role associated with a contributor.
6
6
  class Role
7
+ MARC_RELATORS_FILE_PATH = CocinaDisplay.root / "config" / "marc_relators.yml"
8
+
7
9
  attr_reader :cocina
8
10
 
11
+ # A hash mapping MARC relator codes to their names.
12
+ # @return [Hash{String => String}]
13
+ def self.marc_relators
14
+ @marc_relators ||= YAML.safe_load_file(MARC_RELATORS_FILE_PATH)
15
+ end
16
+
9
17
  # Initialize a Role object with Cocina structured data.
10
18
  # @param cocina [Hash] The Cocina structured data for the role.
11
19
  def initialize(cocina)
@@ -45,7 +53,10 @@ module CocinaDisplay
45
53
  def marc_value
46
54
  return unless marc_relator?
47
55
 
48
- Vocabularies::MARC_RELATOR.fetch(code)
56
+ Role.marc_relators.fetch(code)
57
+ rescue
58
+ CocinaDisplay.notifier&.notify("Invalid marc relator: #{code}")
59
+ nil
49
60
  end
50
61
 
51
62
  # A code associated with the role, e.g. a MARC relator code.
@@ -24,21 +24,21 @@ module CocinaDisplay
24
24
  from_objects(descriptive_values_from_cocina(cocina, label: label))
25
25
  end
26
26
 
27
- # Create display data from a string value.
28
- # @param value [String] The string value to display
27
+ # Create display data from string values.
28
+ # @param value [String] The string values to display
29
29
  # @param label [String] The label for the display data
30
30
  # @return [Array<DisplayData>] The display data
31
- def from_string(value, label: nil)
32
- from_objects(descriptive_values_from_string(value, label: label))
31
+ def from_strings(values, label: nil)
32
+ from_objects(descriptive_values_from_strings(values, label: label))
33
33
  end
34
34
 
35
- # Create an array containing a descriptive object from a string value.
35
+ # Create an array containing a descriptive object from string values.
36
36
  # Can be used to combine a string derived value with other metadata objects.
37
- # @param string [String] The string value to display
37
+ # @param strings [Array<String>] The string values to display
38
38
  # @param label [String] The label for the display data
39
39
  # @return [Array<DescriptiveValue>] The descriptive values
40
- def descriptive_values_from_string(string, label: nil)
41
- [DescriptiveValue.new(label: label, value: string)]
40
+ def descriptive_values_from_strings(strings, label: nil)
41
+ strings.map { |string| DescriptiveValue.new(label: label, value: string) }
42
42
  end
43
43
 
44
44
  # Take one or several DisplayData and merge into a single hash.
@@ -72,7 +72,7 @@ module CocinaDisplay
72
72
 
73
73
  # Create a DisplayData object from a list of objects that share a label
74
74
  # @param label [String]
75
- # @param objects [Array<Object>]
75
+ # @param objects [Array<#to_s>]
76
76
  def initialize(label:, objects:)
77
77
  @label = label
78
78
  @objects = objects
@@ -2,8 +2,16 @@ module CocinaDisplay
2
2
  module Events
3
3
  # A single location represented in a Cocina event, like a publication place.
4
4
  class Location
5
+ MARC_COUNTRIES_FILE_PATH = CocinaDisplay.root / "config" / "marc_countries.yml"
6
+
5
7
  attr_reader :cocina
6
8
 
9
+ # A hash mapping MARC country codes to their names.
10
+ # @return [Hash{String => String}]
11
+ def self.marc_countries
12
+ @marc_countries ||= YAML.safe_load_file(MARC_COUNTRIES_FILE_PATH)
13
+ end
14
+
7
15
  # Initialize a Location object with Cocina structured data.
8
16
  # @param cocina [Hash] The Cocina structured data for the location.
9
17
  def initialize(cocina)
@@ -34,7 +42,7 @@ module CocinaDisplay
34
42
  # Decoded country name if the location is encoded with a MARC country code.
35
43
  # @return [String, nil]
36
44
  def decoded_country
37
- Vocabularies::MARC_COUNTRY[code] if marc_country? && valid_country_code?
45
+ Location.marc_countries[code] if marc_country? && valid_country_code?
38
46
  end
39
47
 
40
48
  # Is this a decodable country code?