Added support for default localization and German translations

This commit is contained in:
squidfunk 2017-10-19 20:09:59 +02:00 committed by Martin Donath
parent 9005ae2381
commit 9f513d6411
21 changed files with 152 additions and 54 deletions

View File

@ -1,7 +1,11 @@
master
* Fixed #374: Search bar misalignment on big screens
mkdocs-material-1.11.0 (2017-10-19)
* Added localization to clipboard
* Refactored i18n localization logic
* Refactored localization logic
mkdocs-material-1.10.4 (2017-10-18)

View File

@ -20,7 +20,7 @@ pip show mkdocs-material | grep -E ^Version
### 1.11.0 <small>_ October 19, 2017</small>
* Added localization to clipboard
* Refactored i18n localization logic
* Refactored localization logic
### 1.10.4 <small>_ October 18, 2017</small>
@ -28,7 +28,7 @@ pip show mkdocs-material | grep -E ^Version
* Improved search UX (don't close on enter if no selection)
* Fixed [#495][495]: Vertical scrollbar on short pages
[495]: https://github.com/squidfunk/mkdocs-material/issues/484
[495]: https://github.com/squidfunk/mkdocs-material/issues/495
### 1.10.3 <small>_ October 11, 2017</small>

View File

@ -1,4 +1,4 @@
{% import "partials/language.html" as lang %}
{% import "partials/language.html" as lang with context %}
<!DOCTYPE html>
<html lang="{{ lang.t('language') }}" class="no-js">
<head>
@ -50,7 +50,7 @@
<script src="{{ base_url }}/assets/javascripts/modernizr-e826f8942a.js"></script>
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-6062816a07.css">
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-04ea671600.css">
{% if config.extra.palette %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-23f75ab9c7.palette.css">
{% endif %}

View File

@ -1,4 +1,4 @@
{% import "partials/language.html" as lang %}
{% import "partials/language.html" as lang with context %}
<footer class="md-footer">
{% if page.previous_page or page.next_page %}
<div class="md-footer-nav">

View File

@ -1,19 +1,3 @@
{% macro t(key) %}{{ {
"language": "en",
"clipboard.copy": "Copy to clipboard",
"clipboard.copied": "Copied to clipboard",
"edit.link.title": "Edit this page",
"footer.previous": "Previous",
"footer.next": "Next",
"meta.comments": "Comments",
"meta.source": "Source",
"search.languages": "",
"search.placeholder": "Search",
"search.result.placeholder": "Type to start searching",
"search.result.none": "No matching documents",
"search.result.one": "1 matching document",
"search.result.other": "# matching documents",
"search.tokenizer": "[\s\-]+",
"source.link.title": "Go to repository",
"toc.title": "Table of contents"
}[key] }}{% endmacro %}
{% set code = config.extra.language | default("en") %}
{% import "partials/language/" + code + ".html" as lang %}
{% macro t(key) %}{{ lang.t(key) }}{% endmacro %}

View File

@ -0,0 +1,19 @@
{% macro t(key) %}{{ {
"language": "de",
"clipboard.copy": "In Zwischenablage kopieren",
"clipboard.copied": "In Zwischenablage kopiert",
"edit.link.title": "Seite editieren",
"footer.previous": "Vorherige Seite",
"footer.next": "Nächste Seite",
"meta.comments": "Kommentare",
"meta.source": "Quellcode",
"search.languages": "de",
"search.placeholder": "Suche",
"search.result.placeholder": "Suchbegriff eingeben",
"search.result.none": "Keine Suchergebnisse",
"search.result.one": "1 Suchergebnis",
"search.result.other": "# Suchergebnisse",
"search.tokenizer": "[\s\-]+",
"source.link.title": "Quellcode",
"toc.title": "Inhaltsverzeichnis"
}[key] }}{% endmacro %}

View File

@ -0,0 +1,19 @@
{% macro t(key) %}{{ {
"language": "en",
"clipboard.copy": "Copy to clipboard",
"clipboard.copied": "Copied to clipboard",
"edit.link.title": "Edit this page",
"footer.previous": "Previous",
"footer.next": "Next",
"meta.comments": "Comments",
"meta.source": "Source",
"search.languages": "",
"search.placeholder": "Search",
"search.result.placeholder": "Type to start searching",
"search.result.none": "No matching documents",
"search.result.one": "1 matching document",
"search.result.other": "# matching documents",
"search.tokenizer": "[\s\-]+",
"source.link.title": "Go to repository",
"toc.title": "Table of contents"
}[key] }}{% endmacro %}

View File

@ -1,4 +1,4 @@
{% import "partials/language.html" as lang %}
{% import "partials/language.html" as lang with context %}
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="search"></label>
<div class="md-search__inner">

View File

@ -1,4 +1,4 @@
{% import "partials/language.html" as lang %}
{% import "partials/language.html" as lang with context %}
{% set platform = config.extra.repo_icon or config.repo_url %}
{% if "github" in platform %}
{% set repo_type = "github" %}

View File

@ -1,4 +1,4 @@
{% import "partials/language.html" as lang %}
{% import "partials/language.html" as lang with context %}
<nav class="md-nav md-nav--secondary">
{% set toc_ = page.toc %}
{% if toc_ | first is defined and "\x3ch1 id=" in page.content %}

View File

@ -36,6 +36,7 @@ theme_dir: material
# Options
extra:
language: en
feature:
tabs: false
palette:

View File

@ -155,6 +155,7 @@ $md-toggle__search--checked:
@include break-from-device(tablet landscape) {
position: relative;
width: 23rem;
float: right;
transition: width 0.25s cubic-bezier(0.1, 0.7, 0.1, 1);
}

View File

@ -20,7 +20,7 @@
IN THE SOFTWARE.
-->
{% import "partials/language.html" as lang %}
{% import "partials/language.html" as lang with context %}
<!DOCTYPE html>
<html lang="{{ lang.t('language') }}" class="no-js">

View File

@ -20,7 +20,7 @@
IN THE SOFTWARE.
-->
{% import "partials/language.html" as lang %}
{% import "partials/language.html" as lang with context %}
<!-- Application footer -->
<footer class="md-footer">

View File

@ -20,23 +20,9 @@
IN THE SOFTWARE.
-->
<!-- Translations -->
{% macro t(key) %}{{ {
"language": "en",
"clipboard.copy": "Copy to clipboard",
"clipboard.copied": "Copied to clipboard",
"edit.link.title": "Edit this page",
"footer.previous": "Previous",
"footer.next": "Next",
"meta.comments": "Comments",
"meta.source": "Source",
"search.languages": "",
"search.placeholder": "Search",
"search.result.placeholder": "Type to start searching",
"search.result.none": "No matching documents",
"search.result.one": "1 matching document",
"search.result.other": "# matching documents",
"search.tokenizer": "[\s\-]+",
"source.link.title": "Go to repository",
"toc.title": "Table of contents"
}[key] }}{% endmacro %}
<!-- Import translations for given language -->
{% set code = config.extra.language | default("en") %}
{% import "partials/language/" + code + ".html" as lang %}
<!-- Re-export translations -->
{% macro t(key) %}{{ lang.t(key) }}{% endmacro %}

View File

@ -0,0 +1,42 @@
<!--
Copyright (c) 2016-2017 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: German -->
{% macro t(key) %}{{ {
"language": "de",
"clipboard.copy": "In Zwischenablage kopieren",
"clipboard.copied": "In Zwischenablage kopiert",
"edit.link.title": "Seite editieren",
"footer.previous": "Vorherige Seite",
"footer.next": "Nächste Seite",
"meta.comments": "Kommentare",
"meta.source": "Quellcode",
"search.languages": "de",
"search.placeholder": "Suche",
"search.result.placeholder": "Suchbegriff eingeben",
"search.result.none": "Keine Suchergebnisse",
"search.result.one": "1 Suchergebnis",
"search.result.other": "# Suchergebnisse",
"search.tokenizer": "[\s\-]+",
"source.link.title": "Quellcode",
"toc.title": "Inhaltsverzeichnis"
}[key] }}{% endmacro %}

View File

@ -0,0 +1,42 @@
<!--
Copyright (c) 2016-2017 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: English -->
{% macro t(key) %}{{ {
"language": "en",
"clipboard.copy": "Copy to clipboard",
"clipboard.copied": "Copied to clipboard",
"edit.link.title": "Edit this page",
"footer.previous": "Previous",
"footer.next": "Next",
"meta.comments": "Comments",
"meta.source": "Source",
"search.languages": "",
"search.placeholder": "Search",
"search.result.placeholder": "Type to start searching",
"search.result.none": "No matching documents",
"search.result.one": "1 matching document",
"search.result.other": "# matching documents",
"search.tokenizer": "[\s\-]+",
"source.link.title": "Go to repository",
"toc.title": "Table of contents"
}[key] }}{% endmacro %}

View File

@ -20,7 +20,7 @@
IN THE SOFTWARE.
-->
{% import "partials/language.html" as lang %}
{% import "partials/language.html" as lang with context %}
<!-- Search interface -->
<div class="md-search" data-md-component="search" role="dialog">

View File

@ -20,7 +20,7 @@
IN THE SOFTWARE.
-->
{% import "partials/language.html" as lang %}
{% import "partials/language.html" as lang with context %}
<!--
Check whether the repository is hosted on one of the supported code hosting

View File

@ -20,7 +20,7 @@
IN THE SOFTWARE.
-->
{% import "partials/language.html" as lang %}
{% import "partials/language.html" as lang with context %}
<!-- Table of contents -->
<nav class="md-nav md-nav--secondary">