Merge pull request #901 from hamidrezakp/improve-multilingual-support

Improve multilingual support and Persian translation
This commit is contained in:
Philipp Oppermann
2021-01-08 10:27:05 +01:00
committed by GitHub
5 changed files with 80 additions and 26 deletions

View File

@@ -35,15 +35,65 @@ author = { name = "Philipp Oppermann" }
[translations.en]
lang_name = "English"
toc = "Table Of Contents"
all_posts = "« All Posts"
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_separator = "and"
[translations.zh-CN]
lang_name = "Chinese (simplified)"
toc = "Table Of Contents"
all_posts = "« All Posts"
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_separator = "and"
[translations.zh-TW]
lang_name = "Chinese (traditional)"
toc = "Table Of Contents"
all_posts = "« All Posts"
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_separator = "and"
[translations.ja]
lang_name = "Japanese"
toc = "Table Of Contents"
all_posts = "« All Posts"
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_separator = "and"
[translations.fa]
lang_name = "Persian"
toc = "فهرست مطالب"
all_posts = "« همه پست‌ها"
comments = "نظرات"
comments_notice = "لطفا نظرات خود را در صورت امکان به انگلیسی بنویسید."
readmore = "ادامه‌مطلب»"
not_translated = "(این پست هنوز ترجمه نشده است.)"
translated_content = "محتوای ترجمه شده:"
translated_content_notice = "این یک ترجمه از جامعه کاربران برای پست <strong><a href=\"_original.permalink_\">_original.title_</a></strong> است. ممکن است ناقص ، منسوخ شده یا دارای خطا باشد. لطفا هر گونه مشکل را گزارش دهید!"
translated_by = "ترجمه توسط"
word_separator = "و"

View File

@@ -2,12 +2,12 @@
template = "edition-2/index.html"
+++
<h1 style="visibility: hidden; height: 0px; margin: 0px; padding: 0px;">Writing an OS in Rust</h1>
<h1 style="visibility: hidden; height: 0px; margin: 0px; padding: 0px;">نوشتن یک سیستم عامل با راست</h1>
<div class="front-page-introduction">
<div class="front-page-introduction right-to-left">
This blog series creates a small operating system in the [Rust programming language](https://www.rust-lang.org/). Each post is a small tutorial and includes all needed code, so you can follow along if you like. The source code is also available in the corresponding [Github repository](https://github.com/phil-opp/blog_os).
این مجموعه بلاگ یک سیستم عامل کوچک در [زبان برنامه نویسی Rust](https://www.rust-lang.org/) ایجاد می کند. هر پست یک آموزش کوچک است و شامل تمام کدهای مورد نیاز است ، بنابراین اگر دوست دارید می توانید آن را دنبال کنید. کد منبع نیز در [مخزن گیت‌هاب](https://github.com/phil-opp/blog_os) مربوطه موجود است.
Latest post: <!-- latest-post -->
اخرین پست: <!-- latest-post -->
</div>

View File

@@ -452,8 +452,9 @@ a strong {
.right-to-left {
direction: rtl;
font-family: Vazir;
}
.left-to-right, .right-to-left pre, .right-to-left table {
.left-to-right, .right-to-left pre, .right-to-left table, .right-to-left[id="toc-aside"] {
direction: ltr;
}

View File

@@ -15,11 +15,11 @@
<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>read&nbsp;more&nbsp;»</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">
(This post is not translated yet.)
{{ trans(key="not_translated", lang=lang) }}
</aside>
{%- endif -%}
</div>
@@ -28,7 +28,7 @@
{% macro toc(toc) %}
<details id = "toc-inline">
<summary><b>Table of Contents</b></summary>
<summary><b>{{ trans(key="toc", lang=lang) }}</b></summary>
<ul>
{% for h2 in toc %}<li>
<a href="#{{h2.id | safe}}">{{ h2.title | safe }}</a>
@@ -38,7 +38,7 @@
</li>{% endfor %}
</ul>{% endif %}
</li>{% endfor %}
<li class="toc-comments-link"><a href="#comments">Comments</a></li>
<li class="toc-comments-link"><a href="#comments">{{ trans(key="comments", lang=lang) }}</a></li>
</ul>
</details>
{% endmacro toc %}

View File

@@ -6,9 +6,9 @@
{% block title %}{{ page.title }} | {{ config.title }}{% endblock title %}
{% block header %}
{% if lang != "en" -%}
<aside id="all-posts-link"><a href="{{ config.base_url | safe }}/{{ lang }}" title="All Posts">« All Posts</a></aside>
<aside id="all-posts-link"><a href="{{ config.base_url | safe }}/{{ lang }}" title="All Posts">{{ trans(key="all_posts", lang=lang) }}</a></aside>
{%- else -%}
<aside id="all-posts-link"><a href="{{ config.base_url | safe }}" title="All Posts">« All Posts</a></aside>
<aside id="all-posts-link"><a href="{{ config.base_url | safe }}" title="All Posts">{{ trans(key="all_posts", lang=lang) }}</a></aside>
{%- endif %}
{% endblock header %}
@@ -17,8 +17,8 @@
{%- endblock description %}
{% block toc_aside %}
<aside id="toc-aside">
<h2>Table of Contents</h2>
<aside id="toc-aside" class="{% if page.extra.rtl %}right-to-left{% endif %}">
<h2>{{ trans(key="toc", lang=lang) }}</h2>
<ol>
{% for h2 in page.toc %}<li>
<a href="#{{h2.id | safe}}">{{ h2.title | safe }}</a>
@@ -28,7 +28,7 @@
</li>{% endfor %}
</ol>{% endif %}
</li>{% endfor %}
<li class="toc-comments-link"><a href="#comments">Comments</a></li>
<li class="toc-comments-link"><a href="#comments">{{ trans(key="comments", lang=lang) }}</a></li>
</ol>
</aside>
{% endblock toc_aside %}
@@ -49,19 +49,22 @@
</div>
{% endif %}
{%- 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_separator", lang=lang) }} {% else %}, {% endif -%}
{%- endif -%}
<a href="https://github.com/{{user}}">@{{user}}</a>
{%- endfor %}.
@@ -70,11 +73,11 @@
</div>
{% endif %}
<div class="{% if page.extra.rtl %}right-to-left{% endif %}">
<div class="{% if page.extra.rtl %}right-to-left{% endif %}">
{{ page.content | replace(from="<!-- toc -->", to=macros::toc(toc=page.toc)) | safe }}
</div>
<div class="post-footer-support">
<div class="post-footer-support{% if page.extra.rtl %} right-to-left{% endif %}">
<h2>Support Me</h2>
{{ snippets::support() }}
</div>
@@ -91,11 +94,11 @@
<hr>
<section>
<h2 id="comments">Comments</h2>
<h2 id="comments" class="{% if page.extra.rtl %}right-to-left{% endif %}">{{ trans(key="comments", lang=lang) }}</h2>
{%- if page.lang != "en" %}
<p>
Please leave your comments in English if possible.
<p class="{% if page.extra.rtl %}right-to-left{% endif %}">
{{ trans(key="comments_notice", lang=lang) }}
</p>
{% endif %}
@@ -118,12 +121,12 @@
</div>
{%- endif %}
<div class="block">
<div class="block{% if page.extra.rtl %} left-to-right{% endif %}">
<h2>About Me</h2>
<p>
I'm a Rust freelancer with a master's degree in computer science. I love systems programming, open source software, and new challenges.
</p><p>
If you want to work with me, reach out on <a href = "https://www.linkedin.com/in/phil-opp/">LinkedIn</a> or write me at <a href="mailto:job@phil-opp.com">job@phil-opp.com</a>.
If you want to work with me, reach out on <a href="https://www.linkedin.com/in/phil-opp/">LinkedIn</a> or write me at <a href="mailto:job@phil-opp.com">job@phil-opp.com</a>.
</p>
</div>
</aside>