Add translation for post warning and some minor fix

This commit is contained in:
Hamid R. K. Pishghadam
2021-01-03 21:50:24 +03:30
parent fad609f744
commit f779303472
3 changed files with 28 additions and 6 deletions

View File

@@ -41,6 +41,10 @@ comments = "Comments"
comments_notice = "Please leave your comments in English if possible."
readmore = "read more »"
not_translated = "(This post is not translated yet.)"
translated_content = "Translated Content:"
translated_content_notice = "This is a community translation of the <strong><a href=\"{{ original.permalink }}\">{{ original.title }}</a></strong> post. It might be incomplete, outdated or contain errors. Please report any issues!"
translated_by = "Translation By"
word_seprator = "and"
[translations.zh-CN]
lang_name = "Chinese (simplified)"
@@ -50,6 +54,10 @@ comments = "Comments"
comments_notice = "Please leave your comments in English if possible."
readmore = "read&nbsp;more&nbsp;»"
not_translated = "(This post is not translated yet.)"
translated_content = "Translated Content:"
translated_content_notice = "This is a community translation of the <strong><a href=\"{{ original.permalink }}\">{{ original.title }}</a></strong> post. It might be incomplete, outdated or contain errors. Please report any issues!"
translated_by = "Translation By"
word_seprator = "and"
[translations.zh-TW]
lang_name = "Chinese (traditional)"
@@ -59,6 +67,10 @@ comments = "Comments"
comments_notice = "Please leave your comments in English if possible."
readmore = "read&nbsp;more&nbsp;»"
not_translated = "(This post is not translated yet.)"
translated_content = "Translated Content:"
translated_content_notice = "This is a community translation of the <strong><a href=\"{{ original.permalink }}\">{{ original.title }}</a></strong> post. It might be incomplete, outdated or contain errors. Please report any issues!"
translated_by = "Translation By"
word_seprator = "and"
[translations.ja]
lang_name = "Japanese"
@@ -68,6 +80,10 @@ comments = "Comments"
comments_notice = "Please leave your comments in English if possible."
readmore = "read&nbsp;more&nbsp;»"
not_translated = "(This post is not translated yet.)"
translated_content = "Translated Content:"
translated_content_notice = "This is a community translation of the <strong><a href=\"{{ original.permalink }}\">{{ original.title }}</a></strong> post. It might be incomplete, outdated or contain errors. Please report any issues!"
translated_by = "Translation By"
word_seprator = "and"
[translations.fa]
lang_name = "Persian"
@@ -77,3 +93,7 @@ comments = "نظرات"
comments_notice = "لطفا نظرات خود را در صورت امکان به انگلیسی بنویسید."
readmore = "ادامه‌مطلب»"
not_translated = "(این پست هنوز ترجمه نشده است.)"
translated_content = "محتوای ترجمه شده:"
translated_content_notice = "این یک ترجمه از جامعه کاربران برای پست <strong><a href=\"_original.permalink_\">_original.title_</a></strong> است. ممکن است ناقص ، منسوخ شده یا دارای خطا باشد. لطفا هر گونه مشکل را گزارش دهید!"
translated_by = "ترجمه توسط"
word_seprator = "و"

View File

@@ -15,7 +15,7 @@
<h2 class="post-title"><a href="{{ post.path | safe }}">{{ post.title }}</a></h2>
<div class="post-summary">
{{ post.summary | safe }}
<a class="read-more" href="{{ post.path | safe }}"><em>{{ trans(key="readmore", lang=lang) }}</em></a>
<a class="read-more" href="{{ post.path | safe }}"><em>{{ trans(key="readmore", lang=lang) | safe }}</em></a>
{%- if lang and not_translated and lang != config.default_language -%}
<aside class="no-translation">

View File

@@ -51,18 +51,20 @@
{%- if page.lang != "en" %}
<div class="warning">
<div class="warning{% if page.extra.rtl %} right-to-left{% endif %}">
{% set translations = page.translations | filter(attribute="lang", value="en") %}
{% set original = translations.0 %}
<p>
<b>Translated Content:</b>
This is a community translation of the <strong><a href="{{ original.permalink }}">{{ original.title }}</a></strong> post. It might be incomplete, outdated or contain errors. Please report any issues!
<b>{{ trans(key="translated_content", lang=lang) }}</b>
{{ trans(key="translated_content_notice", lang=lang) |
replace(from="_original.permalink_", to=original.permalink) |
replace(from="_original.title_", to=original.title) | safe }}
</p>
{%- if page.extra.translators %}
<p>
Translation by {% for user in page.extra.translators -%}
{{ trans(key="translated_by", lang=lang) }} {% for user in page.extra.translators -%}
{%- if not loop.first -%}
{%- if loop.last %}, and {% else %}, {% endif -%}
{%- if loop.last %} {{ trans(key="word_seprator", lang=lang) }} {% else %}, {% endif -%}
{%- endif -%}
<a href="https://github.com/{{user}}">@{{user}}</a>
{%- endfor %}.