mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-28 09:20:52 +01:00
Bring back i18n
This commit is contained in:
parent
b273c429d9
commit
42d6525c50
@ -100,7 +100,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
{% block footer %}
|
{% block footer %}
|
||||||
{% include "partials/footer.html" %}
|
{% include "partials/footer.html" with context %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
{% import "partials/i18n.html" as i18n %}
|
||||||
<footer class="md-footer">
|
<footer class="md-footer">
|
||||||
{% if page.previous_page or page.next_page %}
|
{% if page.previous_page or page.next_page %}
|
||||||
<div class="md-footer-nav">
|
<div class="md-footer-nav">
|
||||||
@ -10,7 +11,7 @@
|
|||||||
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
<span class="md-flex__ellipsis">
|
<span class="md-flex__ellipsis">
|
||||||
<span class="md-footer-nav__direction">
|
<span class="md-footer-nav__direction">
|
||||||
Previous
|
{{ i18n.t('footer.previous') }}
|
||||||
</span>
|
</span>
|
||||||
{{ page.previous_page.title }}
|
{{ page.previous_page.title }}
|
||||||
</span>
|
</span>
|
||||||
@ -22,7 +23,7 @@
|
|||||||
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
<span class="md-flex__ellipsis">
|
<span class="md-flex__ellipsis">
|
||||||
<span class="md-footer-nav__direction">
|
<span class="md-footer-nav__direction">
|
||||||
Next
|
{{ i18n.t('footer.next') }}
|
||||||
</span>
|
</span>
|
||||||
{{ page.next_page.title }}
|
{{ page.next_page.title }}
|
||||||
</span>
|
</span>
|
||||||
|
7
material/partials/i18n.html
Normal file
7
material/partials/i18n.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{% macro t(key) %}{{ {
|
||||||
|
"footer.previous": "Previous",
|
||||||
|
"footer.next": "Next",
|
||||||
|
"search.placeholder": "Search",
|
||||||
|
"source.link.title": "Go to repository",
|
||||||
|
"toc.title": "Table of contents"
|
||||||
|
}[key] }}{% endmacro %}
|
@ -1,8 +1,9 @@
|
|||||||
|
{% import "partials/i18n.html" as i18n %}
|
||||||
<div class="md-search" data-md-component="search">
|
<div class="md-search" data-md-component="search">
|
||||||
<div class="md-search__overlay"></div>
|
<div class="md-search__overlay"></div>
|
||||||
<div class="md-search__inner">
|
<div class="md-search__inner">
|
||||||
<form class="md-search__form" name="search">
|
<form class="md-search__form" name="search">
|
||||||
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false">
|
<input type="text" class="md-search__input" name="query" placeholder="{{ i18n.t('search.placeholder') }}" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false">
|
||||||
<label class="md-icon md-search__icon" for="search"></label>
|
<label class="md-icon md-search__icon" for="search"></label>
|
||||||
</form>
|
</form>
|
||||||
<div class="md-search__output">
|
<div class="md-search__output">
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
{% import "partials/i18n.html" as i18n %}
|
||||||
{% set platform = config.extra.repo_icon or config.repo_url %}
|
{% set platform = config.extra.repo_icon or config.repo_url %}
|
||||||
{% if "github" in platform %}
|
{% if "github" in platform %}
|
||||||
{% set repo_type = "github" %}
|
{% set repo_type = "github" %}
|
||||||
@ -8,7 +9,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{% set repo_type = "" %}
|
{% set repo_type = "" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{{ config.repo_url }}" title="Go to repository" class="md-source" data-md-source="{{ repo_type }}">
|
<a href="{{ config.repo_url }}" title="{{ i18n.t('source.link.title') }}" class="md-source" data-md-source="{{ repo_type }}">
|
||||||
{% if repo_type %}
|
{% if repo_type %}
|
||||||
<div class="md-source__icon">
|
<div class="md-source__icon">
|
||||||
<svg viewBox="0 0 24 24" width="24" height="24">
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
|
{% import "partials/i18n.html" as i18n %}
|
||||||
<nav class="md-nav md-nav--secondary">
|
<nav class="md-nav md-nav--secondary">
|
||||||
{% set toc_ = page.toc %}
|
{% set toc_ = page.toc %}
|
||||||
{% if "\x3ch1 id=" in page.content %}
|
{% if "\x3ch1 id=" in page.content %}
|
||||||
{% set toc_ = (toc_ | first).children %}
|
{% set toc_ = (toc_ | first).children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if toc_ and (toc_ | first) %}
|
{% if toc_ and (toc_ | first) %}
|
||||||
<label class="md-nav__title" for="toc">Table of contents</label>
|
<label class="md-nav__title" for="toc">{{ i18n.t('toc.title') }}</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" %}
|
||||||
|
@ -196,7 +196,7 @@
|
|||||||
|
|
||||||
<!-- Application footer -->
|
<!-- Application footer -->
|
||||||
{% block footer %}
|
{% block footer %}
|
||||||
{% include "partials/footer.html" %}
|
{% include "partials/footer.html" with context %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
IN THE SOFTWARE.
|
IN THE SOFTWARE.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
{% import "partials/i18n.html" as i18n %}
|
||||||
|
|
||||||
<!-- Application footer -->
|
<!-- Application footer -->
|
||||||
<footer class="md-footer">
|
<footer class="md-footer">
|
||||||
|
|
||||||
@ -40,7 +42,7 @@
|
|||||||
md-footer-nav__title">
|
md-footer-nav__title">
|
||||||
<span class="md-flex__ellipsis">
|
<span class="md-flex__ellipsis">
|
||||||
<span class="md-footer-nav__direction">
|
<span class="md-footer-nav__direction">
|
||||||
Previous
|
{{ i18n.t('footer.previous') }}
|
||||||
</span>
|
</span>
|
||||||
{{ page.previous_page.title }}
|
{{ page.previous_page.title }}
|
||||||
</span>
|
</span>
|
||||||
@ -57,7 +59,7 @@
|
|||||||
md-footer-nav__title">
|
md-footer-nav__title">
|
||||||
<span class="md-flex__ellipsis">
|
<span class="md-flex__ellipsis">
|
||||||
<span class="md-footer-nav__direction">
|
<span class="md-footer-nav__direction">
|
||||||
Next
|
{{ i18n.t('footer.next') }}
|
||||||
</span>
|
</span>
|
||||||
{{ page.next_page.title }}
|
{{ page.next_page.title }}
|
||||||
</span>
|
</span>
|
||||||
|
30
src/partials/i18n.html
Normal file
30
src/partials/i18n.html
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<!--
|
||||||
|
Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to
|
||||||
|
deal in the Software without restriction, including without limitation the
|
||||||
|
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
IN THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- Translations -->
|
||||||
|
{% macro t(key) %}{{ {
|
||||||
|
"footer.previous": "Previous",
|
||||||
|
"footer.next": "Next",
|
||||||
|
"search.placeholder": "Search",
|
||||||
|
"source.link.title": "Go to repository",
|
||||||
|
"toc.title": "Table of contents"
|
||||||
|
}[key] }}{% endmacro %}
|
@ -20,13 +20,16 @@
|
|||||||
IN THE SOFTWARE.
|
IN THE SOFTWARE.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
{% import "partials/i18n.html" as i18n %}
|
||||||
|
|
||||||
<!-- Search interface -->
|
<!-- Search interface -->
|
||||||
<div class="md-search" data-md-component="search">
|
<div class="md-search" data-md-component="search">
|
||||||
<div class="md-search__overlay"></div>
|
<div class="md-search__overlay"></div>
|
||||||
<div class="md-search__inner">
|
<div class="md-search__inner">
|
||||||
<form class="md-search__form" name="search">
|
<form class="md-search__form" name="search">
|
||||||
<input type="text" class="md-search__input" name="query"
|
<input type="text" class="md-search__input" name="query"
|
||||||
placeholder="Search" autocapitalize="off" autocorrect="off"
|
placeholder="{{ i18n.t('search.placeholder') }}"
|
||||||
|
autocapitalize="off" autocorrect="off"
|
||||||
autocomplete="off" spellcheck="false" />
|
autocomplete="off" spellcheck="false" />
|
||||||
<label class="md-icon md-search__icon" for="search"></label>
|
<label class="md-icon md-search__icon" for="search"></label>
|
||||||
</form>
|
</form>
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
IN THE SOFTWARE.
|
IN THE SOFTWARE.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
{% import "partials/i18n.html" as i18n %}
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Check whether the repository is hosted on one of the supported code hosting
|
Check whether the repository is hosted on one of the supported code hosting
|
||||||
platforms (Github, Gitlab or Bitbucket) to show icon.
|
platforms (Github, Gitlab or Bitbucket) to show icon.
|
||||||
@ -36,8 +38,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Repository containing source -->
|
<!-- Repository containing source -->
|
||||||
<a href="{{ config.repo_url }}" title="Go to repository" class="md-source"
|
<a href="{{ config.repo_url }}" title="{{ i18n.t('source.link.title') }}"
|
||||||
data-md-source="{{ repo_type }}">
|
class="md-source" data-md-source="{{ repo_type }}">
|
||||||
{% if repo_type %}
|
{% if repo_type %}
|
||||||
<div class="md-source__icon">
|
<div class="md-source__icon">
|
||||||
<svg viewBox="0 0 24 24" width="24" height="24">
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
IN THE SOFTWARE.
|
IN THE SOFTWARE.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
{% import "partials/i18n.html" as i18n %}
|
||||||
|
|
||||||
<!-- 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 %}
|
||||||
@ -36,7 +38,7 @@
|
|||||||
|
|
||||||
<!-- Render item list -->
|
<!-- Render item list -->
|
||||||
{% if toc_ and (toc_ | first) %}
|
{% if toc_ and (toc_ | first) %}
|
||||||
<label class="md-nav__title" for="toc">Table of contents</label>
|
<label class="md-nav__title" for="toc">{{ i18n.t('toc.title') }}</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" %}
|
||||||
|
Loading…
Reference in New Issue
Block a user