[IMP] minor change in trans_load_data now it will create iso code while creating res.lang for transaltion work

bzr revid: mra@tinyerp.com-20091120115721-r9uuewzrqu1cg4ko
This commit is contained in:
mra (Open ERP) 2009-11-20 17:27:21 +05:30
parent 64878b5eb4
commit b2a9a804eb
1 changed files with 26 additions and 25 deletions

View File

@ -611,6 +611,7 @@ def trans_load_data(db_name, fileobj, fileformat, lang, strict=False, lang_name=
lang_obj = pool.get('res.lang')
trans_obj = pool.get('ir.translation')
model_data_obj = pool.get('ir.model.data')
iso_lang = tools.get_iso_codes(lang)
try:
uid = 1
cr = pooler.get_db(db_name).cursor()
@ -636,6 +637,7 @@ def trans_load_data(db_name, fileobj, fileformat, lang, strict=False, lang_name=
lang_info = {
'code': lang,
'iso_code': iso_lang,
'name': lang_name,
'translatable': 1,
'date_format' : str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y')),
@ -643,7 +645,6 @@ def trans_load_data(db_name, fileobj, fileformat, lang, strict=False, lang_name=
'decimal_point' : str(locale.localeconv()['decimal_point']).replace('\xa0', '\xc2\xa0'),
'thousands_sep' : str(locale.localeconv()['thousands_sep']).replace('\xa0', '\xc2\xa0'),
}
try:
lang_obj.create(cr, uid, lang_info)
finally:
@ -737,7 +738,7 @@ def trans_load_data(db_name, fileobj, fileformat, lang, strict=False, lang_name=
logger.notifyChannel("i18n", netsvc.LOG_INFO,
"translation file loaded succesfully")
except IOError:
filename = '[lang: %s][format: %s]' % (lang or 'new', fileformat)
filename = '[lang: %s][format: %s]' % (iso_lang or 'new', fileformat)
logger.notifyChannel("i18n", netsvc.LOG_ERROR, "couldn't read translation file %s" % (filename,))
def get_locales(lang=None):