Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Get language of chapter
  • Loading branch information
kthoden committed Jul 19, 2019
1 parent de1a219 commit 04e5a1f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions imxml2epub.py
Expand Up @@ -515,6 +515,7 @@ def add_css_snippet(css_snippet, css_file):
xmlMetadata = contentopf.find(".//{http://www.idpf.org/2007/opf}metadata")
# Prepare Metadata based on Publication.cfg
cfgPublication = configparser.RawConfigParser()
logging.debug(f"Reading publication.cfg from {OUTPUT_DIR / 'publication.cfg'}.")
cfgPublication.read( OUTPUT_DIR / "publication.cfg")
publication_series = cfgPublication.get("Technical", "Serie")
publication_number = cfgPublication.get("Technical", "Number")
Expand Down Expand Up @@ -794,6 +795,7 @@ def add_css_snippet(css_snippet, css_file):
strFigureCaption = xmlFigureCaption.text or ""
# FIX
dictLangFigures = translation_xml.find("//entry[@name='fig']").attrib
xmlChapter = xmlFigure.xpath("./ancestor::div1")[0]
figures_text = dictLangFigures[libeoaconvert.two_letter_language(xmlChapter.get("language"))]
xmlFigureCaption.text = f"{figures_text} {str(intFigureNumber)}: {strFigureCaption}"
xmlFigure.addnext(xmlFigureCaption)
Expand Down

0 comments on commit 04e5a1f

Please sign in to comment.