@@ -9,7 +9,7 @@ | |||||
<link rel="shortcut icon" href="{{ favicon or "" }}" type="image/x-icon"> | <link rel="shortcut icon" href="{{ favicon or "" }}" type="image/x-icon"> | ||||
<link rel="icon" href="{{ favicon or "" }}" type="image/x-icon"> | <link rel="icon" href="{{ favicon or "" }}" type="image/x-icon"> | ||||
{%- block head_include %}{% endblock -%} | |||||
{%- block head -%} | {%- block head -%} | ||||
{%- if meta_description is defined %} | {%- if meta_description is defined %} | ||||
<meta name="description" content="{{ meta_description|striptags }}"> | <meta name="description" content="{{ meta_description|striptags }}"> | ||||
@@ -40,7 +40,6 @@ | |||||
{%- if script_lib is defined -%}{{ script_lib }}{%- endif -%} | {%- if script_lib is defined -%}{{ script_lib }}{%- endif -%} | ||||
</script> | </script> | ||||
{%- endblock -%} | {%- endblock -%} | ||||
{%- endblock -%} | {%- endblock -%} | ||||
</head> | </head> | ||||
<body> | <body> | ||||
@@ -267,26 +267,4 @@ def update_translations(lang, untranslated_file, translated_file): | |||||
for app in frappe.get_all_apps(True): | for app in frappe.get_all_apps(True): | ||||
write_translations_file(app, lang, full_dict) | write_translations_file(app, lang, full_dict) | ||||
def google_translate(lang, untranslated): | |||||
import requests | |||||
if untranslated: | |||||
response = requests.get("""https://www.googleapis.com/language/translate/v2""", | |||||
params = { | |||||
"key": frappe.conf.google_api_key, | |||||
"source": "en", | |||||
"target": lang, | |||||
"q": "\n".join(untranslated) | |||||
}) | |||||
data = response.json() | |||||
if "error" in data: | |||||
print data | |||||
translated = data["data"]["translations"][0]["translatedText"] | |||||
if translated: | |||||
return dict(zip(untranslated, translated)) | |||||
else: | |||||
print "unable to translate" | |||||
return {} | |||||
@@ -56,6 +56,8 @@ def build_sitemap_options(path): | |||||
# determine templates to be used | # determine templates to be used | ||||
if not sitemap_options.base_template_path: | if not sitemap_options.base_template_path: | ||||
sitemap_options.base_template_path = "templates/base.html" | |||||
app_base = frappe.get_hooks("base_template") | |||||
print app_base | |||||
sitemap_options.base_template_path = app_base[0] if app_base else "templates/base.html" | |||||
return sitemap_options | return sitemap_options |