From ebf87dada153a4c61321750c741e2aac0a810730 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 6 Aug 2014 09:48:02 +0530 Subject: [PATCH] Edit Book: Fix choosing default dictionary based on language tag in the OPF ignoring the country code --- src/calibre/gui2/tweak_book/boss.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index 9dbd4565fe..1e42313924 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -292,7 +292,8 @@ class Boss(QObject): set_current_container(container) with BusyCursor(): self.current_metadata = self.gui.current_metadata = container.mi - set_book_locale(self.current_metadata.language) + lang = container.opf_xpath('//dc:language/text()') or [self.current_metadata.language] + set_book_locale(lang[0]) self.global_undo.open_book(container) self.gui.update_window_title() self.gui.file_list.current_edited_name = None