diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index fb305b9db7..0a4c2c981b 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -25,6 +25,7 @@ from calibre.utils.formatter import TemplateFormatter from calibre.utils.icu import capitalize, collation_order, sort_key from calibre.utils.img import scale_image from calibre.utils.zipfile import ZipFile +from calibre.utils.localization import get_lang, lang_as_iso639_1 class Formatter(TemplateFormatter): @@ -4014,19 +4015,22 @@ class CatalogBuilder(object): """ self.update_progress_full_step(_("Generating OPF")) + lang = get_lang() or 'en' + if lang_as_iso639_1(lang): + lang = lang_as_iso639_1(lang) header = ''' - en-US + LANG - ''' + '''.replace('LANG', lang) # Add the supplied metadata tags soup = BeautifulStoneSoup(header, selfClosingTags=['item', 'itemref', 'meta', 'reference']) metadata = soup.find('metadata')