Added Persian translations

This commit is contained in:
squidfunk 2018-02-01 22:57:00 +01:00 committed by Martin Donath
parent 1df3bf2148
commit 9b717440cc
7 changed files with 79 additions and 10 deletions

View File

@ -1,3 +1,7 @@
mkdocs-material-2.5.6 (2018-02-xx)
* Added Persian translations
mkdocs-material-2.5.5 (2018-01-31) mkdocs-material-2.5.5 (2018-01-31)
* Added Hungarian translations * Added Hungarian translations

View File

@ -69,13 +69,12 @@
{% endfor %} {% endfor %}
{% block extrahead %}{% endblock %} {% block extrahead %}{% endblock %}
</head> </head>
{% set direction = config.theme.direction %}
{% if palette.primary or palette.accent %} {% if palette.primary or palette.accent %}
{% set primary = palette.primary | replace(" ", "-") | lower %} {% set primary = palette.primary | replace(" ", "-") | lower %}
{% set accent = palette.accent | replace(" ", "-") | lower %} {% set accent = palette.accent | replace(" ", "-") | lower %}
<body dir="{{ direction }}" data-md-color-primary="{{ primary }}" data-md-color-accent="{{ accent }}"> <body dir="{{ lang.t('direction') }}" data-md-color-primary="{{ primary }}" data-md-color-accent="{{ accent }}">
{% else %} {% else %}
<body dir="{{ direction }}"> <body dir="{{ lang.t('direction') }}">
{% endif %} {% endif %}
<svg class="md-svg"> <svg class="md-svg">
<defs> <defs>

View File

@ -1,10 +1,11 @@
{% import "partials/language/" + config.theme.language + ".html" as lang %} {% import "partials/language/" + config.theme.language + ".html" as lang %}
{% import "partials/language/en.html" as oops %} {% import "partials/language/en.html" as fallback %}
{% macro t(key) %}{{ { {% macro t(key) %}{{ {
"direction": config.theme.direction,
"search.language": ( "search.language": (
config.extra.search | default({}) config.extra.search | default({})
).language, ).language,
"search.tokenizer": ( "search.tokenizer": (
config.extra.search | default({}) config.extra.search | default({})
).tokenizer | default("", true), ).tokenizer | default("", true),
}[key] or lang.t(key) or oops.t(key) }}{% endmacro %} }[key] or lang.t(key) or fallback.t(key) }}{% endmacro %}

View File

@ -0,0 +1,21 @@
{% macro t(key) %}{{ {
"language": "fa",
"direction": "rtl",
"clipboard.copy": "کپی کردن",
"clipboard.copied": "کپی شد",
"edit.link.title": "این صفحه را ویرایش کنید",
"footer.previous": "قبلی",
"footer.next": "بعدی",
"meta.comments": "نظرات",
"meta.source": "منبع",
"search.language": "en",
"search.placeholder": "جستجو",
"search.result.placeholder": "برای شروع جستجو تایپ کنید",
"search.result.none": "سندی یافت نشد",
"search.result.one": "1 سند یافت شد",
"search.result.other": "# سند یافت شد",
"search.tokenizer": "[\s]+",
"skip.link.title": "پرش به محتویات",
"source.link.title": "رفتن به مخزن",
"toc.title": "فهرست موضوعات"
}[key] }}{% endmacro %}

View File

@ -146,15 +146,14 @@
</head> </head>
<!-- Text direction and color palette, if defined --> <!-- Text direction and color palette, if defined -->
{% set direction = config.theme.direction %}
{% if palette.primary or palette.accent %} {% if palette.primary or palette.accent %}
{% set primary = palette.primary | replace(" ", "-") | lower %} {% set primary = palette.primary | replace(" ", "-") | lower %}
{% set accent = palette.accent | replace(" ", "-") | lower %} {% set accent = palette.accent | replace(" ", "-") | lower %}
<body dir="{{ direction }}" <body dir="{{ lang.t('direction') }}"
data-md-color-primary="{{ primary }}" data-md-color-primary="{{ primary }}"
data-md-color-accent="{{ accent }}"> data-md-color-accent="{{ accent }}">
{% else %} {% else %}
<body dir="{{ direction }}"> <body dir="{{ lang.t('direction') }}">
{% endif %} {% endif %}
<!-- Hidden container for inline SVGs --> <!-- Hidden container for inline SVGs -->

View File

@ -24,14 +24,15 @@
{% import "partials/language/" + config.theme.language + ".html" as lang %} {% import "partials/language/" + config.theme.language + ".html" as lang %}
<!-- Import fallback translations --> <!-- Import fallback translations -->
{% import "partials/language/en.html" as oops %} {% import "partials/language/en.html" as fallback %}
<!-- Re-export translations --> <!-- Re-export translations -->
{% macro t(key) %}{{ { {% macro t(key) %}{{ {
"direction": config.theme.direction,
"search.language": ( "search.language": (
config.extra.search | default({}) config.extra.search | default({})
).language, ).language,
"search.tokenizer": ( "search.tokenizer": (
config.extra.search | default({}) config.extra.search | default({})
).tokenizer | default("", true), ).tokenizer | default("", true),
}[key] or lang.t(key) or oops.t(key) }}{% endmacro %} }[key] or lang.t(key) or fallback.t(key) }}{% endmacro %}

View File

@ -0,0 +1,44 @@
<!--
Copyright (c) 2016-2018 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: Persian -->
{% macro t(key) %}{{ {
"language": "fa",
"direction": "rtl",
"clipboard.copy": "کپی کردن",
"clipboard.copied": "کپی شد",
"edit.link.title": "این صفحه را ویرایش کنید",
"footer.previous": "قبلی",
"footer.next": "بعدی",
"meta.comments": "نظرات",
"meta.source": "منبع",
"search.language": "en",
"search.placeholder": "جستجو",
"search.result.placeholder": "برای شروع جستجو تایپ کنید",
"search.result.none": "سندی یافت نشد",
"search.result.one": "1 سند یافت شد",
"search.result.other": "# سند یافت شد",
"search.tokenizer": "[\s]+",
"skip.link.title": "پرش به محتویات",
"source.link.title": "رفتن به مخزن",
"toc.title": "فهرست موضوعات"
}[key] }}{% endmacro %}