diff --git a/CHANGELOG b/CHANGELOG index ab5b835c8fcef7c776be4b8058bc63c3f47271d5..5792c729f719894e3c248c943de8608726961490 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +mkdocs-material-2.5.6 (2018-02-xx) + + * Added Persian translations + mkdocs-material-2.5.5 (2018-01-31) * Added Hungarian translations diff --git a/material/base.html b/material/base.html index 0fbcd0c8d4cc0630c9de57b6b4be241f850265ae..c9d73808898d29ffc19663bed77981c0d4200242 100644 --- a/material/base.html +++ b/material/base.html @@ -69,13 +69,12 @@ {% endfor %} {% block extrahead %}{% endblock %} </head> - {% set direction = config.theme.direction %} {% if palette.primary or palette.accent %} {% set primary = palette.primary | 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 %} - <body dir="{{ direction }}"> + <body dir="{{ lang.t('direction') }}"> {% endif %} <svg class="md-svg"> <defs> diff --git a/material/partials/language.html b/material/partials/language.html index 0eb19608acceffbb80b69cd8900ae534bf454446..707362263422c06b966a9e7801ce15887a0d9f75 100644 --- a/material/partials/language.html +++ b/material/partials/language.html @@ -1,10 +1,11 @@ {% 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) %}{{ { + "direction": config.theme.direction, "search.language": ( config.extra.search | default({}) ).language, "search.tokenizer": ( config.extra.search | default({}) ).tokenizer | default("", true), -}[key] or lang.t(key) or oops.t(key) }}{% endmacro %} +}[key] or lang.t(key) or fallback.t(key) }}{% endmacro %} diff --git a/material/partials/language/fa.html b/material/partials/language/fa.html new file mode 100644 index 0000000000000000000000000000000000000000..7f5e5cd1731f5d7929231963e75e9be8e72eb22b --- /dev/null +++ b/material/partials/language/fa.html @@ -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 %} diff --git a/src/base.html b/src/base.html index f9c0ca24089b238e69b78c97b32693fcfe6360b2..6e8ae109b71d4f4303b63363462416ee155ed6d8 100644 --- a/src/base.html +++ b/src/base.html @@ -146,15 +146,14 @@ </head> <!-- Text direction and color palette, if defined --> - {% set direction = config.theme.direction %} {% if palette.primary or palette.accent %} {% set primary = palette.primary | replace(" ", "-") | lower %} {% set accent = palette.accent | replace(" ", "-") | lower %} - <body dir="{{ direction }}" + <body dir="{{ lang.t('direction') }}" data-md-color-primary="{{ primary }}" data-md-color-accent="{{ accent }}"> {% else %} - <body dir="{{ direction }}"> + <body dir="{{ lang.t('direction') }}"> {% endif %} <!-- Hidden container for inline SVGs --> diff --git a/src/partials/language.html b/src/partials/language.html index 2a68ad4df8888a4cb4ad1e57fc9ad9f43ae04971..b22e74dae124ffc31c89a04cad048d420691cb78 100644 --- a/src/partials/language.html +++ b/src/partials/language.html @@ -24,14 +24,15 @@ {% import "partials/language/" + config.theme.language + ".html" as lang %} <!-- Import fallback translations --> -{% import "partials/language/en.html" as oops %} +{% import "partials/language/en.html" as fallback %} <!-- Re-export translations --> {% macro t(key) %}{{ { + "direction": config.theme.direction, "search.language": ( config.extra.search | default({}) ).language, "search.tokenizer": ( config.extra.search | default({}) ).tokenizer | default("", true), -}[key] or lang.t(key) or oops.t(key) }}{% endmacro %} +}[key] or lang.t(key) or fallback.t(key) }}{% endmacro %} diff --git a/src/partials/language/fa.html b/src/partials/language/fa.html new file mode 100644 index 0000000000000000000000000000000000000000..8a575f940b186c8b6eebaa8a6d2afe80c4dd6018 --- /dev/null +++ b/src/partials/language/fa.html @@ -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 %}