[FIX] base: specify correct pot file linked to po

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.
Fixes #4326
This commit is contained in:
Ronald Portier (Therp BV) 2014-12-18 11:42:04 +01:00 committed by Martin Trigaux
parent f3c4688715
commit 7c2795ca04
1 changed files with 4 additions and 2 deletions

View File

@ -953,10 +953,12 @@ 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')
addons_module_i18n, _ = os.path.split(fileobj.name)
addons_module, _ = os.path.split(addons_module_i18n)
addons_module, i18n_dir = os.path.split(addons_module_i18n)
addons, module = os.path.split(addons_module)
pot_handle = misc.file_open(os.path.join(addons, module, 'i18n', module + '.pot'))
pot_handle = misc.file_open(os.path.join(
addons, module, i18n_dir, module + '.pot'))
pot_reader = TinyPoFile(pot_handle)
except:
pass