Ver código fonte

allow to set base_template via hooks

version-14
Rushabh Mehta 11 anos atrás
pai
commit
b96543df03
3 arquivos alterados com 5 adições e 26 exclusões
  1. +1
    -2
      frappe/templates/base.html
  2. +1
    -23
      frappe/translate.py
  3. +3
    -1
      frappe/website/sitemap.py

+ 1
- 2
frappe/templates/base.html Ver arquivo

@@ -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>


+ 1
- 23
frappe/translate.py Ver arquivo

@@ -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 {}

+ 3
- 1
frappe/website/sitemap.py Ver arquivo

@@ -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

Carregando…
Cancelar
Salvar