1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-12-01 02:27:17 +01:00

Refactored template localization

This commit is contained in:
squidfunk 2020-03-04 22:06:05 +01:00
parent 66376bbe8c
commit 3242ca974e
16 changed files with 10 additions and 25 deletions

View File

@ -169,16 +169,17 @@
</head> </head>
<!-- Text direction and color palette, if defined --> <!-- Text direction and color palette, if defined -->
{% set direction = config.theme.direction | default(lang.t('direction')) %}
{% if palette.primary or palette.accent %} {% if palette.primary or palette.accent %}
{% set primary = palette.primary | replace(" ", "-") | lower %} {% set primary = palette.primary | replace(" ", "-") | lower %}
{% set accent = palette.accent | replace(" ", "-") | lower %} {% set accent = palette.accent | replace(" ", "-") | lower %}
<body <body
dir="{{ lang.t('direction') }}" dir="{{ direction }}"
data-md-color-primary="{{ primary }}" data-md-color-primary="{{ primary }}"
data-md-color-accent="{{ accent }}" data-md-color-accent="{{ accent }}"
> >
{% else %} {% else %}
<body dir="{{ lang.t('direction') }}"> <body dir="{{ direction }}">
{% endif %} {% endif %}
<!-- <!--
@ -380,8 +381,7 @@
"clipboard.copy", "clipboard.copy",
"clipboard.copied", "clipboard.copied",
"search.language", "search.language",
"search.pipeline.stopwords", "search.pipeline",
"search.pipeline.trimmer",
"search.result.placeholder", "search.result.placeholder",
"search.result.none", "search.result.none",
"search.result.one", "search.result.one",

View File

@ -27,6 +27,4 @@
{% import "partials/language/en.html" as fallback %} {% import "partials/language/en.html" as fallback %}
<!-- Re-export translations --> <!-- Re-export translations -->
{% macro t(key) %}{{ { {% macro t(key) %}{{ lang.t(key) | default(fallback.t(key)) }}{% endmacro %}
"direction": config.theme.direction
}[key] or lang.t(key) or fallback.t(key) }}{% endmacro %}

View File

@ -31,7 +31,6 @@
"footer.next": "التالية", "footer.next": "التالية",
"meta.comments": "التعليقات", "meta.comments": "التعليقات",
"meta.source": "المصدر", "meta.source": "المصدر",
"search.language": "",
"search.pipeline": "", "search.pipeline": "",
"search.placeholder": "بحث", "search.placeholder": "بحث",
"search.result.placeholder": "اكتب لبدء البحث", "search.result.placeholder": "اكتب لبدء البحث",

View File

@ -30,7 +30,6 @@
"footer.next": "Següent", "footer.next": "Següent",
"meta.comments": "Comentaris", "meta.comments": "Comentaris",
"meta.source": "Codi font", "meta.source": "Codi font",
"search.language": "",
"search.placeholder": "Cerca", "search.placeholder": "Cerca",
"search.result.placeholder": "Escriu per a començar a cercar", "search.result.placeholder": "Escriu per a començar a cercar",
"search.result.none": "Cap document coincideix", "search.result.none": "Cap document coincideix",

View File

@ -30,7 +30,6 @@
"footer.next": "Järgmine", "footer.next": "Järgmine",
"meta.comments": "Kommentaarid", "meta.comments": "Kommentaarid",
"meta.source": "Lähtekood", "meta.source": "Lähtekood",
"search.language": "",
"search.pipeline": "", "search.pipeline": "",
"search.placeholder": "Otsi", "search.placeholder": "Otsi",
"search.result.placeholder": "Otsimiseks kirjuta siia", "search.result.placeholder": "Otsimiseks kirjuta siia",

View File

@ -31,7 +31,6 @@
"footer.next": "بعدی", "footer.next": "بعدی",
"meta.comments": "نظرات", "meta.comments": "نظرات",
"meta.source": "منبع", "meta.source": "منبع",
"search.language": "",
"search.pipeline": "", "search.pipeline": "",
"search.placeholder": "جستجو", "search.placeholder": "جستجو",
"search.result.placeholder": "برای شروع جستجو تایپ کنید", "search.result.placeholder": "برای شروع جستجو تایپ کنید",

View File

@ -30,7 +30,6 @@
"footer.next": "Προηγούμενη", "footer.next": "Προηγούμενη",
"meta.comments": "Σχόλια", "meta.comments": "Σχόλια",
"meta.source": "Πηγή", "meta.source": "Πηγή",
"search.language": "",
"search.pipeline": "", "search.pipeline": "",
"search.placeholder": "Αναζήτηση", "search.placeholder": "Αναζήτηση",
"search.result.placeholder": "Πληκτρολογήστε για να αρχίσει η αναζήτηση", "search.result.placeholder": "Πληκτρολογήστε για να αρχίσει η αναζήτηση",

View File

@ -31,7 +31,6 @@
"footer.next": "הַבָּא", "footer.next": "הַבָּא",
"meta.comments": "הערות", "meta.comments": "הערות",
"meta.source": "מָקוֹר", "meta.source": "מָקוֹר",
"search.language": "",
"search.pipeline": "", "search.pipeline": "",
"search.placeholder": "לחפש", "search.placeholder": "לחפש",
"search.result.placeholder": "הקלד כדי להתחיל לחפש", "search.result.placeholder": "הקלד כדי להתחיל לחפש",

View File

@ -30,7 +30,6 @@
"footer.next": "आगामी", "footer.next": "आगामी",
"meta.comments": "टिप्पणियाँ", "meta.comments": "टिप्पणियाँ",
"meta.source": "स्रोत", "meta.source": "स्रोत",
"search.language": "",
"search.pipeline": "", "search.pipeline": "",
"search.placeholder": "खोज", "search.placeholder": "खोज",
"search.result.placeholder": "खोज शुरू करने के लिए टाइप करें", "search.result.placeholder": "खोज शुरू करने के लिए टाइप करें",

View File

@ -30,7 +30,6 @@
"footer.next": "Sljedeće", "footer.next": "Sljedeće",
"meta.comments": "Komentari", "meta.comments": "Komentari",
"meta.source": "Izvor", "meta.source": "Izvor",
"search.language": "",
"search.pipeline": "", "search.pipeline": "",
"search.placeholder": "Pretraživanje", "search.placeholder": "Pretraživanje",
"search.result.placeholder": "Unesite pojam pretraživanja", "search.result.placeholder": "Unesite pojam pretraživanja",

View File

@ -30,7 +30,6 @@
"footer.next": "Selanjutnya", "footer.next": "Selanjutnya",
"meta.comments": "Komentar", "meta.comments": "Komentar",
"meta.source": "Sumber", "meta.source": "Sumber",
"search.language": "",
"search.pipeline": "", "search.pipeline": "",
"search.placeholder": "Cari", "search.placeholder": "Cari",
"search.result.placeholder": "Ketik untuk mulai pencarian", "search.result.placeholder": "Ketik untuk mulai pencarian",

View File

@ -30,7 +30,6 @@
"footer.next": "Następna strona", "footer.next": "Następna strona",
"meta.comments": "Komentarze", "meta.comments": "Komentarze",
"meta.source": "Kod źródłowy", "meta.source": "Kod źródłowy",
"search.language": "",
"search.pipeline": "", "search.pipeline": "",
"search.placeholder": "Szukaj", "search.placeholder": "Szukaj",
"search.result.placeholder": "Zacznij pisać, aby szukać", "search.result.placeholder": "Zacznij pisać, aby szukać",

View File

@ -30,7 +30,6 @@
"footer.next": "Naslednja stran", "footer.next": "Naslednja stran",
"meta.comments": "Komentarji", "meta.comments": "Komentarji",
"meta.source": "Izvorna koda", "meta.source": "Izvorna koda",
"search.language": "",
"search.placeholder": "Išči", "search.placeholder": "Išči",
"search.result.placeholder": "Vpiši iskalni niz", "search.result.placeholder": "Vpiši iskalni niz",
"search.result.none": "Ni zadetkov", "search.result.none": "Ni zadetkov",

View File

@ -30,7 +30,6 @@
"footer.next": "Ďalej", "footer.next": "Ďalej",
"meta.comments": "Komentáre", "meta.comments": "Komentáre",
"meta.source": "Zdroj", "meta.source": "Zdroj",
"search.language": "",
"search.placeholder": "Hľadať", "search.placeholder": "Hľadať",
"search.result.placeholder": "Pre vyhľadávanie začni písať", "search.result.placeholder": "Pre vyhľadávanie začni písať",
"search.result.none": "Žiadne vyhovujúce dokumenty", "search.result.none": "Žiadne vyhovujúce dokumenty",

View File

@ -30,7 +30,6 @@
"footer.next": "Следеће", "footer.next": "Следеће",
"meta.comments": "Коментари", "meta.comments": "Коментари",
"meta.source": "Извор", "meta.source": "Извор",
"search.language": "",
"search.pipeline": "", "search.pipeline": "",
"search.placeholder": "Претрага", "search.placeholder": "Претрага",
"search.result.placeholder": "Унесите појам претраге", "search.result.placeholder": "Унесите појам претраге",

View File

@ -24,7 +24,7 @@
<!-- Table of contents --> <!-- Table of contents -->
<nav class="md-nav md-nav--secondary"> <nav class="md-nav md-nav--secondary">
{% set toc_ = page.toc %} {% set toc = page.toc %}
<!-- <!--
Hack: check whether the content contains a h1 headline. If it does, the Hack: check whether the content contains a h1 headline. If it does, the
@ -32,12 +32,12 @@
to the current page that is located just above the anchor. Therefore we to the current page that is located just above the anchor. Therefore we
directly continue with the children of the anchor. directly continue with the children of the anchor.
--> -->
{% if toc_ | first is defined and "\x3ch1 id=" in page.content %} {% if toc | first is defined and "\x3ch1 id=" in page.content %}
{% set toc_ = (toc_ | first).children %} {% set toc = (toc | first).children %}
{% endif %} {% endif %}
<!-- Render item list --> <!-- Render item list -->
{% if toc_ | first is defined %} {% if toc | first is defined %}
<label class="md-nav__title" for="__toc"> <label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"> <span class="md-nav__icon md-icon">
{% include ".icons/material/arrow-left.svg" %} {% include ".icons/material/arrow-left.svg" %}
@ -45,7 +45,7 @@
{{ lang.t("toc.title") }} {{ lang.t("toc.title") }}
</label> </label>
<ul class="md-nav__list" data-md-scrollfix> <ul class="md-nav__list" data-md-scrollfix>
{% for toc_item in toc_ %} {% for toc_item in toc %}
{% include "partials/toc-item.html" %} {% include "partials/toc-item.html" %}
{% endfor %} {% endfor %}
</ul> </ul>