Merge pull request #2778 from yshurrab/translations-passed-lang-fix

Translate the msg in _ function according to the passed lang, support…
This commit is contained in:
Nabin Hait 2017-03-06 14:30:49 +05:30 committed by GitHub
commit 2f3f17a09b
2 changed files with 3 additions and 2 deletions

View file

@ -48,7 +48,8 @@ def _(msg, lang=None):
# msg should always be unicode
msg = as_unicode(msg).strip()
return get_full_dict(local.lang).get(msg) or msg
# return lang_full_dict according to lang passed parameter
return get_full_dict(lang).get(msg) or msg
def as_unicode(text, encoding='utf-8'):
'''Convert to unicode if required'''

View file

@ -179,7 +179,7 @@ def get_full_dict(lang):
return {}
# found in local, return!
if getattr(frappe.local, 'lang_full_dict', None) is not None:
if getattr(frappe.local, 'lang_full_dict', None) and frappe.local.lang_full_dict.get(lang, None):
return frappe.local.lang_full_dict
frappe.local.lang_full_dict = load_lang(lang)