🌐 feat(i18n): overhaul translation system & add languages (#145)
Revamp the existing translation system, simplifying management and adding several new languages. The new system reads from TOML files in the `/i18n` directory and improves template structures. It also enhances customisation options and robustness by providing fallbacks and modularity. - Implement a new, streamlined translation macro. - Load translations from `/i18n` TOML files. - Remove redundant configuration requirements. - Refactor templates to align with new i18n system. - Add support for Hindi, Japanese, Russian, Portuguese, Chinese, Italian, German, Ukranian, Korean, and French languages. - Credit Thomas Weitzel (@thomasweitzel) for inspiration.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{% macro list_posts(posts, max) %}
|
||||
{% macro list_posts(posts, max, language_strings="") %}
|
||||
|
||||
<div class="bloglist-container">
|
||||
{% for post in posts %}
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
{% if post.date %}
|
||||
<div class="date">
|
||||
{{ macros_format_date::format_date(date=post.date, short=false) }}
|
||||
{{ macros_format_date::format_date(date=post.date, short=false, language_strings=language_strings) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -37,14 +37,14 @@
|
||||
<p>{{ post.summary | striptags | safe | trim_end_matches(pat=".") }}…</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<a class="readmore" href={{ post.permalink }}>{{ macros_translate::translate(key="read_more", default="Read more") }} →</a>
|
||||
<a class="readmore" href={{ post.permalink }}>{{ macros_translate::translate(key="read_more", default="Read more", language_strings=language_strings) }} →</a>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% if not loop.last %}
|
||||
{% if loop.index == max %}
|
||||
<div class="all-posts">
|
||||
<a href="{{ get_url(path="blog", lang=lang) }}/">{{ macros_translate::translate(key="all_posts", default="All posts") }} ⟶</a>
|
||||
<a href="{{ get_url(path="blog", lang=lang) }}/">{{ macros_translate::translate(key="all_posts", default="All posts", language_strings=language_strings) }} ⟶</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user