[MERGE] improve the tools.misc.scan_languages function

bzr revid: stw@openerp.com-20120912104713-jhvkxp9egpchs2ti
This commit is contained in:
Stephane Wirtel 2012-09-12 12:47:13 +02:00
commit 3d2355df04
2 changed files with 7 additions and 11 deletions

View File

@ -77,7 +77,7 @@ class lang(osv.osv):
_logger.warning(msg, lang, lc)
if not lang_name:
lang_name = tools.get_languages().get(lang, lang)
lang_name = tools.ALL_LANGUAGES.get(lang, lang)
def fix_xa0(s):

View File

@ -606,10 +606,7 @@ def get_iso_codes(lang):
lang = lang.split('_')[0]
return lang
def get_languages():
# The codes below are those from Launchpad's Rosetta, with the exception
# of some trivial codes where the Launchpad code is xx and we have xx_XX.
languages={
ALL_LANGUAGES = {
'ab_RU': u'Abkhazian / аҧсуа',
'ar_AR': u'Arabic / الْعَرَبيّة',
'bg_BG': u'Bulgarian / български език',
@ -690,15 +687,14 @@ def get_languages():
'th_TH': u'Thai / ภาษาไทย',
'tlh_TLH': u'Klingon',
}
return languages
def scan_languages():
# Now it will take all languages from get languages function without filter it with base module languages
lang_dict = get_languages()
ret = [(lang, lang_dict.get(lang, lang)) for lang in list(lang_dict)]
ret.sort(key=lambda k:k[1])
return ret
""" Returns all languages supported by OpenERP for translation
:returns: a list of (lang_code, lang_name) pairs
:rtype: [(str, unicode)]
"""
return sorted(ALL_LANGUAGES.iteritems(), key=lambda k: k[1])
def get_user_companies(cr, user):
def _get_company_children(cr, ids):