Skip to content

Commit

Permalink
Translate "OEBPS" filenames
Browse files Browse the repository at this point in the history
We're expecting inzipinfo.filename == "OPS/content.opf" while this
value is "OEBPS/content.opf" for an EPUB file created with
LibreOffice.

#1
  • Loading branch information
PJ-Finlay committed Aug 5, 2023
1 parent e668802 commit 81daf76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion argostranslatefiles/formats/epub.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def translate(self, underlying_translation: ITranslation, file_path: str):

for inzipinfo in inzip.infolist():
with inzip.open(inzipinfo) as infile:
if inzipinfo.filename == "OPS/content.opf" or inzipinfo.filename == "OPS/toc.ncx":
translatable_xml_filenames = ["OPS/content.opf", "OPS/toc.ncx", "OEBPS/content.opf", "OEBPS/toc.ncx"]
if inzipinfo.filename in translatable_xml_filenames:
soup = BeautifulSoup(infile.read(), 'xml')

itag = self.itag_of_soup(soup)
Expand Down

0 comments on commit 81daf76

Please sign in to comment.