From fccdbb6b73d051ebfb5a53a59f6a9bb337829b29 Mon Sep 17 00:00:00 2001 From: Gonzalo Pena-Castellanos Date: Thu, 28 Sep 2017 16:51:17 -0400 Subject: [PATCH] Add better trans and clean up template --- databags/translate.ini | 2 +- templates/layout.html | 86 +++++++++++++++++++++--------------------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/databags/translate.ini b/databags/translate.ini index e366b30..eb63594 100644 --- a/databags/translate.ini +++ b/databags/translate.ini @@ -4,7 +4,7 @@ home = Home edit_on_github = Edit on GitHub create_on_github = Translate on GitHub translation_out_of_date = This translation of the original content is out of date! -see_original_content = See original content +see_original_content = See what changed in the original content update_translation = Update translation on Github ; Footer diff --git a/templates/layout.html b/templates/layout.html index 1a7b8d5..809b232 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -1,23 +1,23 @@ -{% from "macros/translation.html" import transbag %} +{%- from "macros/translation.html" import transbag -%} -{% macro menu_item(identifier) %} - {% set identifier_url = '/' + identifier %} - {% set trans_url = identifier_url|url(alt=this.alt) %} - {% set this_is_child = this.is_child_of(identifier_url) %} +{%- macro menu_item(identifier) -%} + {%- set identifier_url = '/' + identifier -%} + {%- set trans_url = identifier_url|url(alt=this.alt) -%} + {%- set this_is_child = this.is_child_of(identifier_url) -%} -{% endmacro %} +{%- endmacro -%} -{% set t_languages = transbag('menu', this.alt, 'languages') %} -{% set t_sitemap = transbag('translate', this.alt, 'sitemap') %} -{% set t_welcome = transbag('translate', this.alt, 'welcome') %} -{% set t_edit_on_github = transbag('translate', this.alt, 'edit_on_github') %} -{% set t_create_on_github = transbag('translate', this.alt, 'create_on_github') %} -{% set t_translation_out_of_date = transbag('translate', this.alt, 'translation_out_of_date') %} -{% set t_see_original_content = transbag('translate', this.alt, 'see_original_content') %} -{% set t_update_translation = transbag('translate', this.alt, 'update_translation') %} -{% set diff = alt_outdated_diff(this) %} +{%- set t_languages = transbag('menu', this.alt, 'languages') -%} +{%- set t_sitemap = transbag('translate', this.alt, 'sitemap') -%} +{%- set t_welcome = transbag('translate', this.alt, 'welcome') -%} +{%- set t_edit_on_github = transbag('translate', this.alt, 'edit_on_github') -%} +{%- set t_create_on_github = transbag('translate', this.alt, 'create_on_github') -%} +{%- set t_translation_out_of_date = transbag('translate', this.alt, 'translation_out_of_date') -%} +{%- set t_see_original_content = transbag('translate', this.alt, 'see_original_content') -%} +{%- set t_update_translation = transbag('translate', this.alt, 'update_translation') -%} +{%- set diff = alt_outdated_diff(this) -%} @@ -27,7 +27,7 @@ - {% block title %}{{ t_welcome }}{% endblock %} — BeeWare + {%- block title %}{{- t_welcome -}}{% endblock -%} — BeeWare @@ -46,7 +46,7 @@ {%- if diff -%} - {{ get_pygments_css_styles('default')|safe }} + {{- get_pygments_css_styles('default')|safe -}} {%- endif -%} @@ -63,7 +63,7 @@ ga('create', 'UA-2943925-4', 'pybee.org'); ga('send', 'pageview'); - {% block extra_head %}{% endblock %} + {%- block extra_head -%}{%- endblock -%} @@ -83,44 +83,44 @@ ga('send', 'pageview');
- {% block preamble %} - {% endblock %} + {%- block preamble -%} + {%- endblock -%}
- {% if this.alt in get_alts(source=this, fallback=False) and diff %} + {%- if this.alt in get_alts(source=this, fallback=False) and diff -%}
 {{ t_translation_out_of_date }}   {{ t_see_original_content }} @@ -140,22 +140,22 @@ ga('send', 'pageview');
+ - +
- + - {% endif %} - {% block body %}{% endblock %} + {%- endif -%} + {%- block body -%}{%- endblock -%} @@ -177,6 +177,6 @@ ga('send', 'pageview'); - {% block extra_script %}{% endblock %} + {%- block extra_script -%}{%- endblock -%}