mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-24 07:30:12 +01:00
Bring back i18n
This commit is contained in:
parent
b273c429d9
commit
42d6525c50
@ -100,7 +100,7 @@
|
||||
</div>
|
||||
</main>
|
||||
{% block footer %}
|
||||
{% include "partials/footer.html" %}
|
||||
{% include "partials/footer.html" with context %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% block scripts %}
|
||||
|
@ -1,3 +1,4 @@
|
||||
{% import "partials/i18n.html" as i18n %}
|
||||
<footer class="md-footer">
|
||||
{% if page.previous_page or page.next_page %}
|
||||
<div class="md-footer-nav">
|
||||
@ -10,7 +11,7 @@
|
||||
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||
<span class="md-flex__ellipsis">
|
||||
<span class="md-footer-nav__direction">
|
||||
Previous
|
||||
{{ i18n.t('footer.previous') }}
|
||||
</span>
|
||||
{{ page.previous_page.title }}
|
||||
</span>
|
||||
@ -22,7 +23,7 @@
|
||||
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||
<span class="md-flex__ellipsis">
|
||||
<span class="md-footer-nav__direction">
|
||||
Next
|
||||
{{ i18n.t('footer.next') }}
|
||||
</span>
|
||||
{{ page.next_page.title }}
|
||||
</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__overlay"></div>
|
||||
<div class="md-search__inner">
|
||||
<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>
|
||||
</form>
|
||||
<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 %}
|
||||
{% if "github" in platform %}
|
||||
{% set repo_type = "github" %}
|
||||
@ -8,7 +9,7 @@
|
||||
{% else %}
|
||||
{% set repo_type = "" %}
|
||||
{% 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 %}
|
||||
<div class="md-source__icon">
|
||||
<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">
|
||||
{% set toc_ = page.toc %}
|
||||
{% if "\x3ch1 id=" in page.content %}
|
||||
{% set toc_ = (toc_ | first).children %}
|
||||
{% endif %}
|
||||
{% 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>
|
||||
{% for toc_item in toc_ %}
|
||||
{% include "partials/toc-item.html" %}
|
||||
|
@ -196,7 +196,7 @@
|
||||
|
||||
<!-- Application footer -->
|
||||
{% block footer %}
|
||||
{% include "partials/footer.html" %}
|
||||
{% include "partials/footer.html" with context %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
{% import "partials/i18n.html" as i18n %}
|
||||
|
||||
<!-- Application footer -->
|
||||
<footer class="md-footer">
|
||||
|
||||
@ -40,7 +42,7 @@
|
||||
md-footer-nav__title">
|
||||
<span class="md-flex__ellipsis">
|
||||
<span class="md-footer-nav__direction">
|
||||
Previous
|
||||
{{ i18n.t('footer.previous') }}
|
||||
</span>
|
||||
{{ page.previous_page.title }}
|
||||
</span>
|
||||
@ -57,7 +59,7 @@
|
||||
md-footer-nav__title">
|
||||
<span class="md-flex__ellipsis">
|
||||
<span class="md-footer-nav__direction">
|
||||
Next
|
||||
{{ i18n.t('footer.next') }}
|
||||
</span>
|
||||
{{ page.next_page.title }}
|
||||
</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.
|
||||
-->
|
||||
|
||||
{% import "partials/i18n.html" as i18n %}
|
||||
|
||||
<!-- Search interface -->
|
||||
<div class="md-search" data-md-component="search">
|
||||
<div class="md-search__overlay"></div>
|
||||
<div class="md-search__inner">
|
||||
<form class="md-search__form" name="search">
|
||||
<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" />
|
||||
<label class="md-icon md-search__icon" for="search"></label>
|
||||
</form>
|
||||
|
@ -20,6 +20,8 @@
|
||||
IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
{% import "partials/i18n.html" as i18n %}
|
||||
|
||||
<!--
|
||||
Check whether the repository is hosted on one of the supported code hosting
|
||||
platforms (Github, Gitlab or Bitbucket) to show icon.
|
||||
@ -36,8 +38,8 @@
|
||||
{% endif %}
|
||||
|
||||
<!-- Repository containing source -->
|
||||
<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 %}
|
||||
<div class="md-source__icon">
|
||||
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||
|
@ -20,6 +20,8 @@
|
||||
IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
{% import "partials/i18n.html" as i18n %}
|
||||
|
||||
<!-- Table of contents -->
|
||||
<nav class="md-nav md-nav--secondary">
|
||||
{% set toc_ = page.toc %}
|
||||
@ -36,7 +38,7 @@
|
||||
|
||||
<!-- Render item list -->
|
||||
{% 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>
|
||||
{% for toc_item in toc_ %}
|
||||
{% include "partials/toc-item.html" %}
|
||||
|
Loading…
Reference in New Issue
Block a user