Skip to content
Snippets Groups Projects
Verified Commit 4d4a0350 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Use Jinja2 for template translation

parent 0f0b1901
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,9 @@ MARKDOWN = { ...@@ -42,6 +42,9 @@ MARKDOWN = {
"markdown.extensions.md_in_html": {} "markdown.extensions.md_in_html": {}
} }
} }
JINJA_ENVIRONMENT = {
"extensions": ["jinja2.ext.i18n"]
}
MENUITEMS = [ MENUITEMS = [
("Startseite", "index.html"), ("Startseite", "index.html"),
......
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}{{ SITENAME }} — Archives{% endblock %} {% block title %}{% trans %}Artikel{% endtrans %}{% endblock %}
{% block template_content_head %} {% block template_content_head %}
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<h1>News</h1> <h1>{% trans %}Artikel{% endtrans %}</h1>
{% for article in (articles|list + webring_articles|list)|sort(reverse=True, attribute="date") %} {% for article in (articles|list + webring_articles|list)|sort(reverse=True, attribute="date") %}
{% if article.source_link %} {% if article.source_link %}
{# This is a webring article #} {# This is a webring article #}
......
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}{{ article.title|striptags }} - {{ SITETITLE }}{% endblock %} {% block title %}{{ article.title|striptags }}{% endblock %}
{% block head %} {% block head %}
{{ super() }} {{ super() }}
......
{% extends "page.html" %} {% extends "page.html" %}
{% block title %}{{ SITENAME }} — Articles by {{ author }}{% endblock %} {% block title %}{% trans %}Artikel von {{ author }}{% endtrans %}{% endblock %}
{% block content_title %} {% block content_title %}
<h2>Articles by {{ author }}</h2> <h2>{% trans %}Artikel von {{ author }}{% endtrans %}</h2>
{% endblock %} {% endblock %}
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="{{ DESCRIPTION }}" /> <meta name="description" content="{{ DESCRIPTION }}" />
<meta name="author" content="Teckids e.V." /> <meta name="author" content="{{ AUTHOR }}" />
<style> <style>
:root { :root {
--teckids-primary-light: {{ PRIMARY_LIGHT }}ff; --teckids-primary-light: {{ PRIMARY_LIGHT }}ff;
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<link rel="shortcut icon" href="{{ FAVICON }}" /> <link rel="shortcut icon" href="{{ FAVICON }}" />
<title> <title>
{{ SITENAME }} {{ SITENAME }} – {% block title %}{% endblock %}
</title> </title>
</head> </head>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col s12 m6" id="sponsors-box"> <div class="col s12 m6" id="sponsors-box">
<h3 class="black-text sponsorheading">Sponsoren</h3> <h3 class="black-text sponsorheading">{% trans %}Sponsoren{% endtrans %}</h3>
{% for alt, image, url, before in SPONSORS %} {% for alt, image, url, before in SPONSORS %}
{% if before >= TODAY %} {% if before >= TODAY %}
<a href="{{ url }}"><img src="{{ image }}" href="{{ url }}" alt="{{ alt }}" title="{{ alt }}" class="sponsorslogo" /></a> <a href="{{ url }}"><img src="{{ image }}" href="{{ url }}" alt="{{ alt }}" title="{{ alt }}" class="sponsorslogo" /></a>
...@@ -142,19 +142,24 @@ ...@@ -142,19 +142,24 @@
{{ FOOTERTEXT }} {{ FOOTERTEXT }}
</p> </p>
<p class="licence"> <p class="licence">
{% trans %}Dieser Inhalt ist lizenziert unter{% endtrans %}
{% if article is defined %} {% if article is defined %}
{{ LICENCETEXTS[article.lang|default(DEFAULT_LANG)] }} {{ article.metadata.licence|default(LICENCE_DEFAULT) }} {{ article.metadata.licence|default(LICENCE_DEFAULT) }}
{% elif page is defined %} {% elif page is defined %}
{{ LICENCETEXTS[DEFAULT_LANG] }} {{ page.metadata.licence|default(LICENCE_DEFAULT) }} {{ page.metadata.licence|default(LICENCE_DEFAULT) }}
{% else %}
{{ LICENCE_DEFAULT }}
{% endif %} {% endif %}
<br/> <br/>
{% if article is defined %} {% if article is defined %}
<a href="{{ GITWEB_BASE }}/content/{{ article.relative_source_path }}">Edit in source repository</a> <a href="{{ GITWEB_BASE }}/content/{{ article.relative_source_path }}">
{% elif page is defined %} {% elif page is defined %}
<a href="{{ GITWEB_BASE }}/content/{{ page.relative_source_path }}">Edit in source repository</a> <a href="{{ GITWEB_BASE }}/content/{{ page.relative_source_path }}">
{% else %} {% else %}
<a href="{{ GITWEB_BASE }}/content">Edit in source repository</a> <a href="{{ GITWEB_BASE }}/content">
{% endif %} {% endif %}
{% trans %}Im Quell-Repository editieren{% endtrans %}
</a>
</p> </p>
</div> </div>
......
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}{{ page.title|striptags }}{% endblock %}
{% block head %} {% block head %}
{{ super() }} {{ super() }}
<link rel='stylesheet' type='text/css' href="/theme/css/page.css" /> <link rel='stylesheet' type='text/css' href="/theme/css/page.css" />
......
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}{{ page.title|striptags }}{% endblock %}
{% block content %} {% block content %}
<section class='page_content'> <section class='page_content'>
<div class="container"> <div class="container">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment