Skip to content

Commit

Permalink
dojson: fix script code
Browse files Browse the repository at this point in the history
Co-Authored-by: Peter Weber <peter.weber@rero.ch>
  • Loading branch information
rerowep committed Jun 21, 2022
1 parent eb37fed commit 2ec22d9
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions rero_mef/marctojson/do_idref_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
import pytz

from rero_mef.marctojson.helper import COUNTRIES, COUNTRY_UNIMARC_MARC21, \
LANGUAGE_SCRIPTS, LANGUAGES, build_string_list_from_fields, \
remove_trailing_punctuation
LANGUAGES, build_string_list_from_fields, remove_trailing_punctuation

LANGUAGE_SCRIPT_CODES = {
'ba': 'latn',
Expand All @@ -46,18 +45,10 @@

def get_script_code(field):
"""Get script_code from $7."""
languages = {}
if field['7']:
for language_script in LANGUAGE_SCRIPTS:
language, script_code = language_script.split('-')
codes = languages.setdefault(language, {})
codes[script_code] = 1
languages[language] = codes
try:
subfield_7 = field['7']
code = subfield_7[4:6]
script_code = LANGUAGE_SCRIPT_CODES[code]
_ = languages[language][script_code]
except Exception:
script_code = 'latn'
return script_code
Expand Down

0 comments on commit 2ec22d9

Please sign in to comment.