From 65d4b2556555889075043aa5b5060d35708ed386 Mon Sep 17 00:00:00 2001 From: "Ronald Portier (Therp BV)" Date: Thu, 18 Dec 2014 11:57:50 +0100 Subject: [PATCH] [FIX] tools: i18n_extra loading, backport of 7c2795ca In case of different directory for stroing po and pot files than 'i18n' (e.g. 'i18n_extra'), a po could be linked to a wrong pot file. Use the same folder as the po file to look for pot. Closes #4323 --- openerp/tools/translate.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openerp/tools/translate.py b/openerp/tools/translate.py index bdc6052dbdd..f20414547b3 100644 --- a/openerp/tools/translate.py +++ b/openerp/tools/translate.py @@ -981,10 +981,13 @@ def trans_load_data(cr, fileobj, fileformat, lang, lang_name=None, verbose=True, # Normally the path looks like /path/to/xxx/i18n/lang.po # and we try to find the corresponding # /path/to/xxx/i18n/xxx.pot file. + # (Sometimes we have 'i18n_extra' instead of just 'i18n') head, _ = os.path.split(fileobj.name) - head2, _ = os.path.split(head) - head3, tail3 = os.path.split(head2) - pot_handle = misc.file_open(os.path.join(head3, tail3, 'i18n', tail3 + '.pot')) + head2, i18n_dir = os.path.split(head) + head3, module_dir = os.path.split(head2) + pot_path = os.path.join( + head3, module_dir, i18n_dir, module_dir + '.pot') + pot_handle = misc.file_open(pot_path) pot_reader = TinyPoFile(pot_handle) except: pass