Ver a proveniência

Translate the msg in _ function according to the passed lang, support multiple language in frappe.cash()

version-14
Yaqin Shurrab há 8 anos
ascendente
cometimento
c28880eb27
2 ficheiros alterados com 5 adições e 2 eliminações
  1. +2
    -1
      frappe/__init__.py
  2. +3
    -1
      frappe/translate.py

+ 2
- 1
frappe/__init__.py Ver ficheiro

@@ -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
# Retrun 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'''


+ 3
- 1
frappe/translate.py Ver ficheiro

@@ -179,7 +179,9 @@ def get_full_dict(lang):
return {}

# found in local, return!
if getattr(frappe.local, 'lang_full_dict', None) is not None:
# Check if the passed lang exists in lang_full_dict cash in frappe
if not getattr(frappe.local, 'lang_full_dict',
None) is None and frappe.local.lang_full_dict and lang in frappe.local.lang_full_dict:
return frappe.local.lang_full_dict

frappe.local.lang_full_dict = load_lang(lang)


Carregando…
Cancelar
Guardar