slub / mets-mods2tei

Convert bibliographic meta data in MODS format to TEI headers
Apache License 2.0
8 stars 7 forks source link

mets: other language than german #47

Closed tboenig closed 3 years ago

tboenig commented 4 years ago

Hi @wrznr ,

here a problem with a other language than german. METS snippet: <mods:languageTerm authority="iso639-2b" type="code">lat</mods:languageTerm>

mm2tei --ocr "https://content.staatsbibliothek-berlin.de/dc/PPN647473836.mets.xml"

Traceback (most recent call last):
  File "mets-mods2tei/env/bin/mm2tei", line 8, in <module>
    sys.exit(cli())
  File "mets-mods2tei/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "mets-mods2tei/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "mets-mods2tei/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "mets-mods2tei/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "mets-mods2tei/env/lib/python3.6/site-packages/mets_mods2tei/scripts/mets_mods2tei.py", line 35, in cli
    mets.fromfile(f)
  File "mets-mods2tei/env/lib/python3.6/site-packages/mets_mods2tei/api/mets.py", line 112, in fromfile
    self.__spur()
  File "mets-mods2tei/env/lib/python3.6/site-packages/mets_mods2tei/api/mets.py", line 185, in __spur
    self.languages[language_term.get_valueOf_()] = babel.Locale.parse(language_term.get_valueOf_()).get_language_name('de')
  File "mets-mods2tei/env/lib/python3.6/site-packages/babel/core.py", line 331, in parse
    raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'lat'
wrznr commented 4 years ago

Actually, it is not a problem with other than German but rather a problem with lat. The Python package that mets-mods2tei uses for translating ISO 639-2 codes to "real" language names (which for some reason DTABf requires) does not work for Latin. Thanks for pointing out this issue! Fix will be provided.

tboenig commented 4 years ago

Hi @wrznr,

An automatic and complete translation into another format is ideal. But this cannot always be guaranteed. See mets:Hdr. For this reason I would suggest that the program does everything possible and, in case of problems, gives me a log file documenting the difficulties of the conversion.