Exemple #1
0
def render_page_by_language(path):
	translated_languages = frappe.get_hooks("translated_languages_for_website")
	user_lang = guess_language(translated_languages)
	if translated_languages and user_lang in translated_languages:
		try:
			if path and path != "index":
				lang_path = '{0}/{1}'.format(user_lang, path)
			else:
				lang_path = user_lang # index

			return render_page(lang_path)
		except frappe.DoesNotExistError:
			return render_page(path)

	else:
		return render_page(path)
Exemple #2
0
def render_page_by_language(path):
    translated_languages = frappe.get_hooks("translated_languages_for_website")
    user_lang = guess_language(translated_languages)
    if translated_languages and user_lang in translated_languages:
        try:
            if path and path != "index":
                lang_path = '{0}/{1}'.format(user_lang, path)
            else:
                lang_path = user_lang  # index

            return render_page(lang_path)
        except frappe.DoesNotExistError:
            return render_page(path)

    else:
        return render_page(path)
Exemple #3
0
 def set_lang(self):
     from frappe.translate import guess_language
     frappe.local.lang = guess_language()
Exemple #4
0
	def set_lang(self):
		from frappe.translate import guess_language
		frappe.local.lang = guess_language()
Exemple #5
0
 def set_lang(self):
     frappe.local.lang = guess_language()