allow to set base_template via hooks
This commit is contained in:
parent
f7dcd8eca8
commit
b96543df03
3 changed files with 5 additions and 26 deletions
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<link rel="shortcut icon" href="{{ favicon or "" }}" type="image/x-icon">
|
||||
<link rel="icon" href="{{ favicon or "" }}" type="image/x-icon">
|
||||
|
||||
{%- block head_include %}{% endblock -%}
|
||||
{%- block head -%}
|
||||
{%- if meta_description is defined %}
|
||||
<meta name="description" content="{{ meta_description|striptags }}">
|
||||
|
|
@ -40,7 +40,6 @@
|
|||
{%- if script_lib is defined -%}{{ script_lib }}{%- endif -%}
|
||||
</script>
|
||||
{%- endblock -%}
|
||||
|
||||
{%- endblock -%}
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -267,26 +267,4 @@ def update_translations(lang, untranslated_file, translated_file):
|
|||
|
||||
for app in frappe.get_all_apps(True):
|
||||
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
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue