diff --git a/examples/language/docs/index.md b/examples/language/docs/index.md new file mode 100644 index 000000000..72bb22301 --- /dev/null +++ b/examples/language/docs/index.md @@ -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 %} +``` diff --git a/examples/language/mkdocs.yml b/examples/language/mkdocs.yml new file mode 100644 index 000000000..5e9663e75 --- /dev/null +++ b/examples/language/mkdocs.yml @@ -0,0 +1,31 @@ +# Copyright (c) 2016-2017 Martin Donath + +# 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 diff --git a/examples/language/theme/partials/language.html b/examples/language/theme/partials/language.html new file mode 100644 index 000000000..8c796f5ae --- /dev/null +++ b/examples/language/theme/partials/language.html @@ -0,0 +1,39 @@ + + + +{% 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 %}