示例#1
0
def _translate_untranslated(context, lang):
	for site in context.sites:
		try:
			frappe.init(site=site)
			frappe.connect()
			translate_untranslated_from_google(lang)
			frappe.db.commit()
		finally:
			frappe.destroy()
示例#2
0
def _translate_untranslated_all(context):
	for site in context.sites:
		try:
			frappe.init(site=site)
			frappe.connect()
			for lang in frappe.db.sql_list("select name from tabLanguage"):
				translate_untranslated_from_google(lang)
			frappe.db.commit()
		finally:
			frappe.destroy()
示例#3
0
def _translate_untranslated_all(context):
    for site in context.sites:
        try:
            frappe.init(site=site)
            frappe.connect()
            for lang in frappe.db.sql_list("select name from tabLanguage"):
                translate_untranslated_from_google(lang)
            frappe.db.commit()
        finally:
            frappe.destroy()
示例#4
0
def _translate_untranslated_all(context):
	for site in context.sites:
		try:
			frappe.init(site=site)
			frappe.connect()
			for lang in frappe.db.sql_list("select name from tabLanguage"):
				try:
					translate_untranslated_from_google(lang)
				except requests.exceptions.HTTPError:
					print("skipping {0}".format(lang))
					continue
				finally:
					frappe.db.commit()
		finally:
			frappe.destroy()