[FIX] translations: export wizard should also export _sql_constraints + cleanup
bzr revid: odo@openerp.com-20101020163822-myx69vpr1vavlqru
This commit is contained in:
parent
eed35f8c52
commit
69ea053093
|
@ -1005,9 +1005,6 @@ def get_languages():
|
||||||
return languages
|
return languages
|
||||||
|
|
||||||
def scan_languages():
|
def scan_languages():
|
||||||
# import glob
|
|
||||||
# file_list = [os.path.splitext(os.path.basename(f))[0] for f in glob.glob(os.path.join(config['root_path'],'addons', 'base', 'i18n', '*.po'))]
|
|
||||||
# ret = [(lang, lang_dict.get(lang, lang)) for lang in file_list]
|
|
||||||
# Now it will take all languages from get languages function without filter it with base module languages
|
# Now it will take all languages from get languages function without filter it with base module languages
|
||||||
lang_dict = get_languages()
|
lang_dict = get_languages()
|
||||||
ret = [(lang, lang_dict.get(lang, lang)) for lang in list(lang_dict)]
|
ret = [(lang, lang_dict.get(lang, lang)) for lang in list(lang_dict)]
|
||||||
|
|
|
@ -630,14 +630,20 @@ def trans_generate(lang, modules, dbname=None):
|
||||||
except (IOError, etree.XMLSyntaxError):
|
except (IOError, etree.XMLSyntaxError):
|
||||||
logging.getLogger("i18n").exception("couldn't export translation for report %s %s %s", name, report_type, fname)
|
logging.getLogger("i18n").exception("couldn't export translation for report %s %s %s", name, report_type, fname)
|
||||||
|
|
||||||
for constraint in pool.get(model)._constraints:
|
model_obj = pool.get(model)
|
||||||
msg = constraint[1]
|
def push_constraint_msg(module, term_type, model, msg):
|
||||||
# Check presence of __call__ directly instead of using
|
# Check presence of __call__ directly instead of using
|
||||||
# callable() because it will be deprecated as of Python 3.0
|
# callable() because it will be deprecated as of Python 3.0
|
||||||
if not hasattr(msg, '__call__'):
|
if not hasattr(msg, '__call__'):
|
||||||
push_translation(module, 'constraint', model, 0, encode(msg))
|
push_translation(module, term_type, model, 0, encode(msg))
|
||||||
|
|
||||||
for field_name,field_def in pool.get(model)._columns.items():
|
for constraint in model_obj._constraints:
|
||||||
|
push_constraint_msg(module, 'constraint', model, constraint[1])
|
||||||
|
|
||||||
|
for constraint in model_obj._sql_constraints:
|
||||||
|
push_constraint_msg(module, 'sql_constraint', model, constraint[2])
|
||||||
|
|
||||||
|
for field_name,field_def in model_obj._columns.items():
|
||||||
if field_def.translate:
|
if field_def.translate:
|
||||||
name = model + "," + field_name
|
name = model + "," + field_name
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue