using trans for most common short texts

This commit is contained in:
Hamid R. K. Pishghadam
2021-01-03 19:00:14 +03:30
parent 63d9828213
commit 478b4cb808
3 changed files with 68 additions and 18 deletions

View File

@@ -35,15 +35,65 @@ author = { name = "Philipp Oppermann" }
[translations.en] [translations.en]
lang_name = "English" lang_name = "English"
toc = "Table Of Contents"
all_posts = "« All Posts"
support_me = "Support Me"
comments = "Comments"
comments_notice = "Please leave your comments in English if possible."
other_languages = "Other Languages"
about_me = "About Me"
about_me_text_1 = "I'm a Rust freelancer with a master's degree in computer science. I love systems programming, open source software, and new challenges."
readmore = "read more »"
not_translated = "(This post is not translated yet.)"
[translations.zh-CN] [translations.zh-CN]
lang_name = "Chinese (simplified)" lang_name = "Chinese (simplified)"
toc = "Table Of Contents"
all_posts = "« All Posts"
support_me = "Support Me"
comments = "Comments"
comments_notice = "Please leave your comments in English if possible."
other_languages = "Other Languages"
about_me = "About Me"
about_me_text_1 = "I'm a Rust freelancer with a master's degree in computer science. I love systems programming, open source software, and new challenges."
readmore = "read more »"
not_translated = "(This post is not translated yet.)"
[translations.zh-TW] [translations.zh-TW]
lang_name = "Chinese (traditional)" lang_name = "Chinese (traditional)"
toc = "Table Of Contents"
all_posts = "« All Posts"
support_me = "Support Me"
comments = "Comments"
comments_notice = "Please leave your comments in English if possible."
other_languages = "Other Languages"
about_me = "About Me"
about_me_text_1 = "I'm a Rust freelancer with a master's degree in computer science. I love systems programming, open source software, and new challenges."
readmore = "read more »"
not_translated = "(This post is not translated yet.)"
[translations.ja] [translations.ja]
lang_name = "Japanese" lang_name = "Japanese"
toc = "Table Of Contents"
all_posts = "« All Posts"
support_me = "Support Me"
comments = "Comments"
comments_notice = "Please leave your comments in English if possible."
other_languages = "Other Languages"
about_me = "About Me"
about_me_text_1 = "I'm a Rust freelancer with a master's degree in computer science. I love systems programming, open source software, and new challenges."
readmore = "read more »"
not_translated = "(This post is not translated yet.)"
[translations.fa] [translations.fa]
lang_name = "Persian" lang_name = "Persian"
toc = "فهرست مطالب"
all_posts = "« همه پست‌ها"
support_me = "مرا پشتیبانی کنید"
comments = "نظرات"
comments_notice = "لطفا نظرات خود را در صورت امکان به انگلیسی بنویسید."
other_languages = "زبان های دیگر"
about_me = "درباره من"
about_me_text_1 = "من یک فریلنسر Rust با مدرک ارشد علوم کامپیوتر هستم. من عاشق برنامه نویسی سیستمی، نرم افزار متن باز و چالش های جدید هستم."
readmore = "ادامه‌مطلب»"
not_translated = "(این پست هنوز ترجمه نشده است.)"

View File

@@ -15,11 +15,11 @@
<h2 class="post-title"><a href="{{ post.path | safe }}">{{ post.title }}</a></h2> <h2 class="post-title"><a href="{{ post.path | safe }}">{{ post.title }}</a></h2>
<div class="post-summary"> <div class="post-summary">
{{ post.summary | safe }} {{ 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) }}</em></a>
{%- if lang and not_translated and lang != config.default_language -%} {%- if lang and not_translated and lang != config.default_language -%}
<aside class="no-translation"> <aside class="no-translation">
(This post is not translated yet.) {{ trans(key="not_translated", lang=lang) }}
</aside> </aside>
{%- endif -%} {%- endif -%}
</div> </div>
@@ -28,7 +28,7 @@
{% macro toc(toc) %} {% macro toc(toc) %}
<details id = "toc-inline"> <details id = "toc-inline">
<summary><b>Table of Contents</b></summary> <summary><b>{{ trans(key="toc", lang=lang) }}</b></summary>
<ul> <ul>
{% for h2 in toc %}<li> {% for h2 in toc %}<li>
<a href="#{{h2.id | safe}}">{{ h2.title | safe }}</a> <a href="#{{h2.id | safe}}">{{ h2.title | safe }}</a>
@@ -38,7 +38,7 @@
</li>{% endfor %} </li>{% endfor %}
</ul>{% endif %} </ul>{% endif %}
</li>{% endfor %} </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> </ul>
</details> </details>
{% endmacro toc %} {% endmacro toc %}

View File

@@ -6,9 +6,9 @@
{% block title %}{{ page.title }} | {{ config.title }}{% endblock title %} {% block title %}{{ page.title }} | {{ config.title }}{% endblock title %}
{% block header %} {% block header %}
{% if lang != "en" -%} {% 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 -%} {%- 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 %} {%- endif %}
{% endblock header %} {% endblock header %}
@@ -18,7 +18,7 @@
{% block toc_aside %} {% block toc_aside %}
<aside id="toc-aside"> <aside id="toc-aside">
<h2>Table of Contents</h2> <h2>{{ trans(key="toc", lang=lang) }}</h2>
<ol> <ol>
{% for h2 in page.toc %}<li> {% for h2 in page.toc %}<li>
<a href="#{{h2.id | safe}}">{{ h2.title | safe }}</a> <a href="#{{h2.id | safe}}">{{ h2.title | safe }}</a>
@@ -28,7 +28,7 @@
</li>{% endfor %} </li>{% endfor %}
</ol>{% endif %} </ol>{% endif %}
</li>{% endfor %} </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> </ol>
</aside> </aside>
{% endblock toc_aside %} {% endblock toc_aside %}
@@ -74,8 +74,8 @@
{{ page.content | replace(from="<!-- toc -->", to=macros::toc(toc=page.toc)) | safe }} {{ page.content | replace(from="<!-- toc -->", to=macros::toc(toc=page.toc)) | safe }}
</div> </div>
<div class="post-footer-support"> <div class="post-footer-support{% if page.extra.rtl %} right-to-left{% endif %}">
<h2>Support Me</h2> <h2>{{ trans(key="support_me", lang=lang) }}</h2>
{{ snippets::support() }} {{ snippets::support() }}
</div> </div>
@@ -91,21 +91,21 @@
<hr> <hr>
<section> <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" %} {%- if page.lang != "en" %}
<p> <p class="{% if page.extra.rtl %}right-to-left{% endif %}">
Please leave your comments in English if possible. {{ trans(key="comments_notice", lang=lang) }}
</p> </p>
{% endif %} {% endif %}
{{ snippets::utterances() }} {{ snippets::utterances() }}
</section> </section>
<aside class="page-aside-right"> <aside class="page-aside-right{% if page.extra.rtl %} right-to-left{% endif %}">
{% if page.translations -%} {% if page.translations -%}
<div class="block" id="language-selector"> <div class="block" id="language-selector">
<h2>Other Languages</h2> <h2>{{ trans(key="other_languages", lang=lang) }}</h2>
<ul>{%- for translation in page.translations | sort(attribute="lang") %} <ul>{%- for translation in page.translations | sort(attribute="lang") %}
<li data-lang-switch-to="{{ translation.lang }}" class=""><a href="{{ translation.permalink | safe }}"> <li data-lang-switch-to="{{ translation.lang }}" class=""><a href="{{ translation.permalink | safe }}">
{%- if translation.lang == "en" -%} {%- if translation.lang == "en" -%}
@@ -119,11 +119,11 @@
{%- endif %} {%- endif %}
<div class="block"> <div class="block">
<h2>About Me</h2> <h2>{{ trans(key="about_me", lang=lang) }}</h2>
<p> <p>
I'm a Rust freelancer with a master's degree in computer science. I love systems programming, open source software, and new challenges. {{ trans(key="about_me_text_1", lang=lang) }}
</p><p> </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> </p>
</div> </div>
</aside> </aside>