Added example how to change language

This commit is contained in:
squidfunk 2017-06-20 18:51:33 +02:00 committed by Martin Donath
parent cb8900d973
commit 7d373a128c
3 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,27 @@
# Example
This example project contains a configuration for the German language. All
footer and search labels (or placeholders), as well as link titles have been
translated to German. Use this example as a starting point for a project with
another language than English.
The translations can be changed in `theme/partials/language.html`:
``` jinja
{% macro t(key) %}{{ {
"language": "de",
"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",
"source.link.title": "Quellcode",
"toc.title": "Inhaltsverzeichnis"
}[key] }}{% endmacro %}
```

View File

@ -0,0 +1,31 @@
# 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.
# Project information
site_name: Example
# Repository
repo_name: squidfunk/mkdocs-material
repo_url: https://github.com/squidfunk/mkdocs-material
# Reference the original theme and the directory which contains the
# overrides for the partials, i.e. the language.html.
theme: material
theme_dir: theme

View File

@ -0,0 +1,39 @@
<!--
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 -->
{% macro t(key) %}{{ {
"language": "de",
"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",
"source.link.title": "Quellcode",
"toc.title": "Inhaltsverzeichnis"
}[key] }}{% endmacro %}