[MERGE] improve the tools.misc.scan_languages function
bzr revid: stw@openerp.com-20120912104713-jhvkxp9egpchs2ti
This commit is contained in:
commit
3d2355df04
|
@ -77,7 +77,7 @@ class lang(osv.osv):
|
||||||
_logger.warning(msg, lang, lc)
|
_logger.warning(msg, lang, lc)
|
||||||
|
|
||||||
if not lang_name:
|
if not lang_name:
|
||||||
lang_name = tools.get_languages().get(lang, lang)
|
lang_name = tools.ALL_LANGUAGES.get(lang, lang)
|
||||||
|
|
||||||
|
|
||||||
def fix_xa0(s):
|
def fix_xa0(s):
|
||||||
|
|
|
@ -606,10 +606,7 @@ def get_iso_codes(lang):
|
||||||
lang = lang.split('_')[0]
|
lang = lang.split('_')[0]
|
||||||
return lang
|
return lang
|
||||||
|
|
||||||
def get_languages():
|
ALL_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={
|
|
||||||
'ab_RU': u'Abkhazian / аҧсуа',
|
'ab_RU': u'Abkhazian / аҧсуа',
|
||||||
'ar_AR': u'Arabic / الْعَرَبيّة',
|
'ar_AR': u'Arabic / الْعَرَبيّة',
|
||||||
'bg_BG': u'Bulgarian / български език',
|
'bg_BG': u'Bulgarian / български език',
|
||||||
|
@ -690,15 +687,14 @@ def get_languages():
|
||||||
'th_TH': u'Thai / ภาษาไทย',
|
'th_TH': u'Thai / ภาษาไทย',
|
||||||
'tlh_TLH': u'Klingon',
|
'tlh_TLH': u'Klingon',
|
||||||
}
|
}
|
||||||
return languages
|
|
||||||
|
|
||||||
def scan_languages():
|
def scan_languages():
|
||||||
# Now it will take all languages from get languages function without filter it with base module languages
|
""" Returns all languages supported by OpenERP for translation
|
||||||
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: 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_user_companies(cr, user):
|
||||||
def _get_company_children(cr, ids):
|
def _get_company_children(cr, ids):
|
||||||
|
|
Loading…
Reference in New Issue