Skip to content

Commit

Permalink
Fix import of bib 880
Browse files Browse the repository at this point in the history
Broken by refactoring of language resources
  • Loading branch information
olovy committed Aug 16, 2023
1 parent e942a8e commit 2a6f6a4
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package whelk.converter.marc

import groovy.transform.MapConstructor
import groovy.util.logging.Log4j2 as Log

import whelk.ResourceCache
import whelk.filter.LanguageLinker
import whelk.util.DocumentUtil
import whelk.util.Unicode

Expand All @@ -19,8 +16,7 @@ class RomanizationStep extends MarcFramePostProcStepBase {
boolean requiresResources = true

MarcFrameConverter converter
ResourceCache.LanguageResources languageResources


Map langAliases
Map byLangToBase

Expand Down Expand Up @@ -70,12 +66,12 @@ class RomanizationStep extends MarcFramePostProcStepBase {
}

void _modify(Map record, Map thing) {
if (!languageResources) {
if (!resourceCache?.languageResources) {
return
}

def workLang = thing.instanceOf.subMap('language')
languageResources.languageLinker.linkAll(workLang)
resourceCache.languageResources.languageLinker.linkAll(workLang)
def romanizable = asList(workLang.language).findResults { it[ID] in romanizableLangs ? it[ID] : null }

if (romanizable.size() > 1) {
Expand Down Expand Up @@ -547,14 +543,12 @@ class RomanizationStep extends MarcFramePostProcStepBase {
this.byLangToBase = langAliases.collectEntries { k, v -> [v, k] }
}

if (!languageResources) {
if (!resourceCache?.languageResources) {
return
}

var languageResources = resourceCache.languageResources

this.langLinker = languageResources.languageLinker

this.langIdToLangTag = languageResources.languages
.findAll { k, v -> v.langTag }.collectEntries { k, v -> [k, v.langTag] }
this.romanizableLangs = languageResources.transformedLanguageForms
Expand Down

0 comments on commit 2a6f6a4

Please sign in to comment.