[MERGE] --i18n-overwrite can be used with --update.

bzr revid: vmt@openerp.com-20110512134553-7iomtd21nqsxs63q
This commit is contained in:
Vo Minh Thu 2011-05-12 15:45:53 +02:00
commit 4a6155d80c
3 changed files with 7 additions and 5 deletions

View File

@ -779,7 +779,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
modobj.write(cr, 1, [mid], {'state': 'installed', 'latest_version': ver})
cr.commit()
# Update translations for all installed languages
modobj.update_translations(cr, 1, [mid], None)
modobj.update_translations(cr, 1, [mid], None, {'overwrite': tools.config['overwrite_existing_translations']})
cr.commit()
package.state = 'installed'

View File

@ -479,7 +479,9 @@ class module(osv.osv):
categs = categs[1:]
self.write(cr, uid, [mod_browse.id], {'category_id': p_id})
def update_translations(self, cr, uid, ids, filter_lang=None, context={}):
def update_translations(self, cr, uid, ids, filter_lang=None, context=None):
if context is None:
context = {}
logger = logging.getLogger('i18n')
if not filter_lang:
pool = pooler.get_pool(cr.dbname)

View File

@ -217,7 +217,7 @@ class configmanager(object):
group.add_option("--i18n-import", dest="translate_in",
help="import a CSV or a PO file with translations and exit. The '-l' option is required.")
group.add_option("--i18n-overwrite", dest="overwrite_existing_translations", action="store_true", default=False,
help="overwrites existing translation terms on importing a CSV or a PO file.")
help="overwrites existing translation terms on updating a module or importing a CSV or a PO file.")
group.add_option("--modules", dest="translate_modules",
help="specify modules to export. Use in combination with --i18n-export")
group.add_option("--addons-path", dest="addons_path",
@ -266,8 +266,8 @@ class configmanager(object):
die(opt.translate_in and (not opt.language or not opt.db_name),
"the i18n-import option cannot be used without the language (-l) and the database (-d) options")
die(opt.overwrite_existing_translations and (not opt.translate_in),
"the i18n-overwrite option cannot be used without the i18n-import option")
die(opt.overwrite_existing_translations and not (opt.translate_in or opt.update),
"the i18n-overwrite option cannot be used without the i18n-import option or without the update option")
die(opt.translate_out and (not opt.db_name),
"the i18n-export option cannot be used without the database (-d) option")