perf(i18n): set the global default locales to "en" (#979)

Avoid missing labels caused by languages ​​outside of locales.
This commit is contained in:
Cotes Chung 2023-05-06 07:22:29 +08:00
parent aca79c1007
commit 61fdbcb83a
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
23 changed files with 417 additions and 342 deletions

View file

@ -4,12 +4,16 @@
-->
{% assign wrap_elem = include.wrap | default: 'em' %}
{% assign df_strftime = site.data.locales[site.lang].df.post.strftime | default: '%d/%m/%Y' %}
{% assign df_dayjs = site.data.locales[site.lang].df.post.dayjs | default: 'DD/MM/YYYY' %}
{% assign df_strftime = site.data.locales[include.lang].df.post.strftime | default: '%d/%m/%Y' %}
{% assign df_dayjs = site.data.locales[include.lang].df.post.dayjs | default: 'DD/MM/YYYY' %}
<{{ wrap_elem }} class="{% if include.class %}{{ include.class }}{% endif %}"
<{{ wrap_elem }}
class="{% if include.class %}{{ include.class }}{% endif %}"
data-ts="{{ include.date | date: '%s' }}"
data-df="{{ df_dayjs }}"
{% if include.tooltip %}data-toggle="tooltip" data-placement="bottom"{% endif %}>
{% if include.tooltip %}
data-toggle="tooltip" data-placement="bottom"
{% endif %}
>
{{ include.date | date: df_strftime }}
</{{ wrap_elem }}>

View file

@ -5,18 +5,22 @@
<div class="d-flex justify-content-between align-items-center text-muted ml-md-3 mr-md-3">
<div class="footer-left">
<p class="mb-0">
© {{ 'now' | date: "%Y" }}
© {{ 'now' | date: '%Y' }}
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
{% if site.data.locales[site.lang].copyright.brief %}
<span data-toggle="tooltip" data-placement="top"
title="{{ site.data.locales[site.lang].copyright.verbose }}">{{ site.data.locales[site.lang].copyright.brief }}</span>
{% if site.data.locales[include.lang].copyright.brief %}
<span
data-toggle="tooltip"
data-placement="top"
title="{{ site.data.locales[include.lang].copyright.verbose }}"
>
{{- site.data.locales[include.lang].copyright.brief -}}
</span>
{% endif %}
</p>
</div>
<div class="footer-right">
<p class="mb-0">
{%- capture _platform -%}
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
{%- endcapture -%}
@ -25,9 +29,11 @@
<a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
{%- endcapture -%}
{{ site.data.locales[site.lang].meta
{{
site.data.locales[include.lang].meta
| default: 'Using the :PLATFORM theme :THEME.'
| replace: ':PLATFORM', _platform | replace: ':THEME', _theme
| replace: ':PLATFORM', _platform
| replace: ':THEME', _theme
}}
</p>
</div>

8
_includes/lang.html Normal file
View file

@ -0,0 +1,8 @@
{% comment %}
Detect appearance language and return it through variable "lang"
{% endcomment %}
{% if site.data.locales[site.lang] %}
{% assign lang = site.lang %}
{% else %}
{% assign lang = 'en' %}
{% endif %}

View file

@ -1,30 +1,37 @@
<!--
Navigation buttons at the bottom of the post.
-->
<!-- Navigation buttons at the bottom of the post. -->
<div class="post-navigation d-flex justify-content-between">
{% if page.previous.url %}
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary"
prompt="{{ site.data.locales[site.lang].post.button.previous }}">
<a
href="{{ site.baseurl }}{{ page.previous.url }}"
class="btn btn-outline-primary"
prompt="{{ site.data.locales[include.lang].post.button.previous }}"
>
<p>{{ page.previous.title }}</p>
</a>
{% else %}
<div class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[site.lang].post.button.previous }}">
<div
class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[include.lang].post.button.previous }}"
>
<p>-</p>
</div>
{% endif %}
{% if page.next.url %}
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary"
prompt="{{ site.data.locales[site.lang].post.button.next }}">
<a
href="{{ site.baseurl }}{{page.next.url}}"
class="btn btn-outline-primary"
prompt="{{ site.data.locales[include.lang].post.button.next }}"
>
<p>{{ page.next.title }}</p>
</a>
{% else %}
<div class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[site.lang].post.button.next }}">
<div
class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[include.lang].post.button.next }}"
>
<p>-</p>
</div>
{% endif %}
</div>

View file

@ -1,9 +1,7 @@
<!--
Post sharing snippet
-->
<!-- Post sharing snippet -->
<div class="share-wrapper">
<span class="share-label text-muted mr-1">{{ site.data.locales[site.lang].post.share }}</span>
<span class="share-label text-muted mr-1">{{ site.data.locales[include.lang].post.share }}</span>
<span class="share-icons">
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
{% assign title = title | uri_escape %}
@ -11,17 +9,27 @@
{% for share in site.data.share.platforms %}
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
<a href="{{ link }}" data-toggle="tooltip" data-placement="top"
title="{{ share.type }}" target="_blank" rel="noopener" aria-label="{{ share.type }}">
<a
href="{{ link }}"
data-toggle="tooltip"
data-placement="top"
title="{{ share.type }}"
target="_blank"
rel="noopener"
aria-label="{{ share.type }}"
>
<i class="fa-fw {{ share.icon }}"></i>
</a>
{% endfor %}
<i id="copy-link" class="fa-fw fas fa-link small"
data-toggle="tooltip" data-placement="top"
title="{{ site.data.locales[site.lang].post.button.share_link.title }}"
data-title-succeed="{{ site.data.locales[site.lang].post.button.share_link.succeed }}">
<i
id="copy-link"
class="fa-fw fas fa-link small"
data-toggle="tooltip"
data-placement="top"
title="{{ site.data.locales[include.lang].post.button.share_link.title }}"
data-title-succeed="{{ site.data.locales[include.lang].post.button.share_link.succeed }}"
>
</i>
</span>
</div>

View file

@ -1,8 +1,6 @@
<!--
Calculate the post's reading time, and display the word count in tooltip
-->
<!-- Calculate the post's reading time, and display the word count in tooltip -->
{% assign words = include.content | strip_html | number_of_words: "auto" %}
{% assign words = include.content | strip_html | number_of_words: 'auto' %}
<!-- words per minute -->
@ -16,15 +14,24 @@
{% endunless %}
{% capture read_prompt %}
{{- site.data.locales[site.lang].post.read_time.prompt -}}
{{- site.data.locales[include.lang].post.read_time.prompt -}}
{% endcapture %}
<!-- return element -->
<span class="readtime" data-toggle="tooltip" data-placement="bottom"
title="{{ words }} {{ site.data.locales[site.lang].post.words }}">
<em>{{- read_time -}}{{" "}}{{- site.data.locales[site.lang].post.read_time.unit -}}</em>
<span
class="readtime"
data-toggle="tooltip"
data-placement="bottom"
title="{{ words }} {{ site.data.locales[include.lang].post.words }}"
>
<em>
{{- read_time -}}
{{ ' ' }}
{{- site.data.locales[include.lang].post.read_time.unit -}}
</em>
{%- if include.prompt -%}
{%- assign _prompt_words = read_prompt | number_of_words: 'auto' -%}
{%- unless _prompt_words > 1 -%}{{ " " }}{%- endunless -%}{{ read_prompt }}
{%- unless _prompt_words > 1 -%}{{ ' ' }}{%- endunless -%}
{{ read_prompt }}
{%- endif -%}
</span>

View file

@ -225,7 +225,7 @@
| append: '<div class="code-header">'
| append: _label
| append: '<button aria-label="copy" data-title-succeed="'
| append: site.data.locales[site.lang].post.button.copy_code.succeed
| append: site.data.locales[include.lang].post.button.copy_code.succeed
| append: '"><i class="far fa-clipboard"></i></button></div>'
| append: '<div class="highlight"><code>'
%}

View file

@ -12,9 +12,9 @@
<!-- Equals to TAG_SCORE / {max_categories_hierarchy} -->
{% assign CATEGORY_SCORE = 0.5 %}
{% assign SEPARATOR = ":" %}
{% assign SEPARATOR = ':' %}
{% assign score_list = "" | split: "" %}
{% assign score_list = '' | split: '' %}
{% assign last_index = site.posts.size | minus: 1 %}
{% for i in (0..last_index) %}
@ -42,11 +42,9 @@
{% capture score_item %}{{ score }}{{ SEPARATOR }}{{ i }}{% endcapture %}
{% assign score_list = score_list | push: score_item %}
{% endif %}
{% endfor %}
{% assign index_list = "" | split: "" %}
{% assign index_list = '' | split: '' %}
{% if score_list.size > 0 %}
{% assign score_list = score_list | sort | reverse %}
@ -77,8 +75,12 @@
{% if index_list.size > 0 %}
<div id="related-posts" class="mb-2 mb-sm-4">
<h3 class="pt-2 mb-4 ml-1"
data-toc-skip>{{ site.data.locales[site.lang].post.relate_posts }}</h3>
<h3
class="pt-2 mb-4 ml-1"
data-toc-skip
>
{{ site.data.locales[include.lang].post.relate_posts }}
</h3>
<div class="card-deck mb-4">
{% for entry in index_list %}
{% assign index = entry | plus: 0 %}
@ -86,7 +88,7 @@
<div class="card">
<a href="{{ post.url | relative_url }}">
<div class="card-body">
{% include datetime.html date=post.date class="small" %}
{% include datetime.html date=post.date class="small" lang=include.lang %}
<h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3>
<div class="text-muted small">
<p>
@ -98,6 +100,8 @@
</a>
</div>
{% endfor %}
</div> <!-- .card-deck -->
</div> <!-- #related-posts -->
</div>
<!-- .card-deck -->
</div>
<!-- #related-posts -->
{% endif %}

View file

@ -14,7 +14,7 @@
</div>
{% endcapture %}
{% capture not_found %}<p class="mt-5">{{ site.data.locales[site.lang].search.no_results }}</p>{% endcapture %}
{% capture not_found %}<p class="mt-5">{{ site.data.locales[include.lang].search.no_results }}</p>{% endcapture %}
<script src="{{ site.data.assets[origin].search.js | relative_url }}"></script>

View file

@ -1,6 +1,4 @@
<!--
The Side Bar
-->
<!-- The Side Bar -->
<div id="sidebar" class="d-flex flex-column align-items-end">
<div class="profile-wrapper text-center">
@ -25,16 +23,15 @@
<a href="{{ '/' | relative_url }}">{{ site.title }}</a>
</div>
<div class="site-subtitle font-italic">{{ site.tagline }}</div>
</div><!-- .profile-wrapper -->
</div>
<!-- .profile-wrapper -->
<ul class="w-100">
<!-- home -->
<li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}">
<a href="{{ '/' | relative_url }}" class="nav-link">
<i class="fa-fw fas fa-home ml-xl-3 mr-xl-3 unloaded"></i>
<span>{{ site.data.locales[site.lang].tabs.home | upcase }}</span>
<span>{{ site.data.locales[include.lang].tabs.home | upcase }}</span>
</a>
</li>
<!-- the real tabs -->
@ -44,15 +41,15 @@
<i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
{% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %}
<span>{{ site.data.locales[site.lang].tabs.[tab_name] | default: tab.title | upcase }}</span>
<span>{{ site.data.locales[include.lang].tabs.[tab_name] | default: tab.title | upcase }}</span>
</a>
</li> <!-- .nav-item -->
</li>
<!-- .nav-item -->
{% endfor %}
</ul> <!-- ul.nav.flex-column -->
</ul>
<!-- ul.nav.flex-column -->
<div class="sidebar-bottom mt-auto d-flex flex-wrap justify-content-center align-items-center">
{% unless site.theme_mode %}
<button class="mode-toggle btn" aria-label="Switch Mode">
<i class="fas fa-adjust"></i>
@ -81,7 +78,9 @@
{% endcase %}
{% if url %}
<a href="{{ url }}" aria-label="{{ entry.type }}"
<a
href="{{ url }}"
aria-label="{{ entry.type }}"
{% assign link_types = '' %}
{% unless entry.noblank %}
@ -93,14 +92,15 @@
{% assign link_types = link_types | append: ' me' | strip %}
{% endif %}
{% unless link_types == empty %}rel="{{ link_types }}"{% endunless %}>
{% unless link_types == empty %}
rel="{{ link_types }}"
{% endunless %}
>
<i class="{{ entry.icon }}"></i>
</a>
{% endif %}
{% endfor %}
</div> <!-- .sidebar-bottom -->
</div><!-- #sidebar -->
</div>
<!-- .sidebar-bottom -->
</div>
<!-- #sidebar -->

View file

@ -7,7 +7,7 @@
{% if enable_toc %}
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[site.lang].panel.toc -}}</div>
<div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[include.lang].panel.toc -}}</div>
<nav id="toc"></nav>
</div>

View file

@ -1,32 +1,26 @@
<!--
The Top Bar
-->
<!-- The Top Bar -->
<div id="topbar-wrapper">
<div id="topbar" class="container d-flex align-items-center justify-content-between h-100 pl-3 pr-3 pl-md-4 pr-md-4">
<span id="breadcrumb">
{% assign paths = page.url | split: '/' %}
{% if paths.size == 0 or page.layout == 'home' %}
<!-- index page -->
<span>{{ site.data.locales[site.lang].tabs.home | capitalize }}</span>
<span>{{ site.data.locales[include.lang].tabs.home | capitalize }}</span>
{% else %}
{% for item in paths %}
{% if forloop.first %}
<span>
<a href="{{ '/' | relative_url }}">
{{ site.data.locales[site.lang].tabs.home | capitalize }}
{{ site.data.locales[include.lang].tabs.home | capitalize }}
</a>
</span>
{% elsif forloop.last %}
{% if page.collection == 'tabs' %}
<span>{{ site.data.locales[site.lang].tabs[item] | default: page.title }}</span>
<span>{{ site.data.locales[include.lang].tabs[item] | default: page.title }}</span>
{% else %}
<span>{{ page.title }}</span>
{% endif %}
@ -34,37 +28,40 @@
{% elsif page.layout == 'category' or page.layout == 'tag' %}
<span>
<a href="{{ item | relative_url }}">
{{ site.data.locales[site.lang].tabs[item] | default: page.title }}
{{ site.data.locales[include.lang].tabs[item] | default: page.title }}
</a>
</span>
{% endif %}
{% endfor %}
{% endif %}
</span><!-- endof #breadcrumb -->
</span>
<!-- endof #breadcrumb -->
<i id="sidebar-trigger" class="fas fa-bars fa-fw"></i>
<div id="topbar-title">
{% if page.layout == 'home' %}
{{- site.data.locales[site.lang].title | default: site.title -}}
{{- site.data.locales[include.lang].title | default: site.title -}}
{% elsif page.collection == 'tabs' or page.layout == 'page' %}
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
{{- site.data.locales[site.lang].tabs[tab_key] | default: page.title -}}
{{- site.data.locales[include.lang].tabs[tab_key] | default: page.title -}}
{% else %}
{{- site.data.locales[site.lang].layout[page.layout] | default: page.layout | capitalize -}}
{{- site.data.locales[include.lang].layout[page.layout] | default: page.layout | capitalize -}}
{% endif %}
</div>
<i id="search-trigger" class="fas fa-search fa-fw"></i>
<span id="search-wrapper" class="align-items-center">
<i class="fas fa-search fa-fw"></i>
<input class="form-control" id="search-input" type="search"
aria-label="search" autocomplete="off" placeholder="{{ site.data.locales[site.lang].search.hint | capitalize }}...">
<input
class="form-control"
id="search-input"
type="search"
aria-label="search"
autocomplete="off"
placeholder="{{ site.data.locales[include.lang].search.hint | capitalize }}..."
>
</span>
<span id="search-cancel" >{{ site.data.locales[site.lang].search.cancel }}</span>
<span id="search-cancel">{{ site.data.locales[include.lang].search.cancel }}</span>
</div>
</div>

View file

@ -4,14 +4,14 @@
{% assign MAX = 10 %}
{% assign size_list = "" | split: "" %}
{% assign tag_list = "" | split: "" %}
{% assign size_list = '' | split: '' %}
{% assign tag_list = '' | split: '' %}
{% for tag in site.tags %}
{% assign size = tag | last | size %}
{% assign size_list = size_list | push: size %}
{% assign tag_str = tag | first | append: "::" | append: size %}
{% assign tag_str = tag | first | append: '::' | append: size %}
{% assign tag_list = tag_list | push: tag_str %}
{% endfor %}
@ -19,11 +19,11 @@
{% assign tag_list = tag_list | sort_natural %}
{% assign trending_tags = "" | split: "" %}
{% assign trending_tags = '' | split: '' %}
{% for size in size_list limit: MAX %}
{% for tag_str in tag_list %}
{% assign tag = tag_str | split: "::" %}
{% assign tag = tag_str | split: '::' %}
{% assign tag_name = tag | first %}
{% assign tag_size = tag | last | plus: 0 %}
{% if tag_size == size %}
@ -37,14 +37,12 @@
{% if trending_tags.size > 0 %}
<div id="access-tags">
<div class="panel-heading">{{- site.data.locales[site.lang].panel.trending_tags -}}</div>
<div class="panel-heading">{{- site.data.locales[include.lang].panel.trending_tags -}}</div>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% for tag_name in trending_tags %}
{% assign url = tag_name | slugify | url_encode | prepend: "/tags/" | append: "/" %}
{% assign url = tag_name | slugify | url_encode | prepend: '/tags/' | append: '/' %}
<a class="post-tag" href="{{ url | relative_url }}">{{ tag_name }}</a>
{% endfor %}
</div>
</div>
{% endif %}

View file

@ -4,7 +4,7 @@
{% assign MAX_SIZE = 5 %}
{% assign all_list = "" | split: "" %}
{% assign all_list = '' | split: '' %}
{% for post in site.posts %}
{% if post.last_modified_at %}
@ -17,24 +17,25 @@
{% assign all_list = all_list | sort | reverse %}
{% assign update_list = "" | split: "" %}
{% assign update_list = '' | split: '' %}
{% for entry in all_list limit:MAX_SIZE %}
{% for entry in all_list limit: MAX_SIZE %}
{% assign update_list = update_list | push: entry %}
{% endfor %}
{% if update_list.size > 0 %}
<div id="access-lastmod" class="post">
<div class="panel-heading">{{- site.data.locales[site.lang].panel.lastmod -}}</div>
<div class="panel-heading">{{- site.data.locales[include.lang].panel.lastmod -}}</div>
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
{% for item in update_list %}
{% assign index = item | split: "::" | last | plus: 0 %}
{% assign index = item | split: '::' | last | plus: 0 %}
{% assign post = site.posts[index] %}
{% assign url = post.url | relative_url %}
<li><a href="{{ url }}">{{ post.title }}</a></li>
<li>
<a href="{{ url }}">{{ post.title }}</a>
</li>
{% endfor %}
</ul>
</div> <!-- #access-lastmod -->
</div>
<!-- #access-lastmod -->
{% endif %}

View file

@ -3,8 +3,10 @@ layout: page
# The Archives of posts.
---
{% assign df_strftime_m = site.data.locales[site.lang].df.archives.strftime | default: '/ %m' %}
{% assign df_dayjs_m = site.data.locales[site.lang].df.archives.dayjs | default: '/ MM' %}
{% include lang.html %}
{% assign df_strftime_m = site.data.locales[lang].df.archives.strftime | default: '/ %m' %}
{% assign df_dayjs_m = site.data.locales[lang].df.archives.dayjs | default: '/ MM' %}
<div id="archives" class="pl-xl-3">

View file

@ -3,8 +3,10 @@ layout: page
# All the Categories of posts
---
{% assign HEAD_PREFIX = "h_" %}
{% assign LIST_PREFIX = "l_" %}
{% include lang.html %}
{% assign HEAD_PREFIX = 'h_' %}
{% assign LIST_PREFIX = 'l_' %}
{% assign group_index = 0 %}
@ -16,7 +18,7 @@ layout: page
{% assign first_post = posts_of_category | first %}
{% if category_name == first_post.categories[0] %}
{% assign sub_categories = "" | split: "" %}
{% assign sub_categories = '' | split: '' %}
{% for post in posts_of_category %}
{% assign second_category = post.categories[1] %}
@ -32,8 +34,10 @@ layout: page
<div class="card categories">
<!-- top-category -->
<div id="{{ HEAD_PREFIX }}{{ group_index }}"
class="card-header d-flex justify-content-between hide-border-bottom">
<div
id="{{ HEAD_PREFIX }}{{ group_index }}"
class="card-header d-flex justify-content-between hide-border-bottom"
>
<span>
<i class="far fa-folder{% if sub_categories_size > 0 %}-open{% endif %} fa-fw"></i>
@ -46,31 +50,44 @@ layout: page
{% if sub_categories_size > 0 %}
{{ sub_categories_size }}
{% if sub_categories_size > 1 %}
{{ site.data.locales[site.lang].categories.category_measure.plural
| default: site.data.locales[site.lang].categories.category_measure }}
{{
site.data.locales[lang].categories.category_measure.plural
| default: site.data.locales[lang].categories.category_measure
}}
{% else %}
{{ site.data.locales[site.lang].categories.category_measure.singular
| default: site.data.locales[site.lang].categories.category_measure }}
{% endif %},
{{
site.data.locales[lang].categories.category_measure.singular
| default: site.data.locales[lang].categories.category_measure
}}
{% endif -%}
,
{% endif %}
{{ top_posts_size }}
{% if top_posts_size > 1 %}
{{ site.data.locales[site.lang].categories.post_measure.plural
| default: site.data.locales[site.lang].categories.post_measure }}
{{
site.data.locales[lang].categories.post_measure.plural
| default: site.data.locales[lang].categories.post_measure
}}
{% else %}
{{ site.data.locales[site.lang].categories.post_measure.singular
| default: site.data.locales[site.lang].categories.post_measure }}
{{
site.data.locales[lang].categories.post_measure.singular
| default: site.data.locales[lang].categories.post_measure
}}
{% endif %}
</span>
</span>
<!-- arrow -->
{% if sub_categories_size > 0%}
<a href="#{{ LIST_PREFIX }}{{ group_index }}" data-toggle="collapse"
aria-expanded="true" aria-label="{{ HEAD_PREFIX }}{{ group_index }}-trigger"
class="category-trigger hide-border-bottom">
{% if sub_categories_size > 0 %}
<a
href="#{{ LIST_PREFIX }}{{ group_index }}"
data-toggle="collapse"
aria-expanded="true"
aria-label="{{ HEAD_PREFIX }}{{ group_index }}-trigger"
class="category-trigger hide-border-bottom"
>
<i class="fas fa-fw fa-angle-down"></i>
</a>
{% else %}
@ -78,8 +95,8 @@ layout: page
<i class="fas fa-fw fa-angle-right"></i>
</span>
{% endif %}
</div> <!-- .card-header -->
</div>
<!-- .card-header -->
<!-- Sub-categories -->
{% if sub_categories_size > 0 %}
@ -97,11 +114,15 @@ layout: page
{{ posts_size }}
{% if posts_size > 1 %}
{{ site.data.locales[site.lang].categories.post_measure.plural
| default: site.data.locales[site.lang].categories.post_measure }}
{{
site.data.locales[lang].categories.post_measure.plural
| default: site.data.locales[lang].categories.post_measure
}}
{% else %}
{{ site.data.locales[site.lang].categories.post_measure.singular
| default: site.data.locales[site.lang].categories.post_measure }}
{{
site.data.locales[lang].categories.post_measure.singular
| default: site.data.locales[lang].categories.post_measure
}}
{% endif %}
</span>
</li>
@ -109,10 +130,9 @@ layout: page
</ul>
</div>
{% endif %}
</div> <!-- .card -->
</div>
<!-- .card -->
{% assign group_index = group_index | plus: 1 %}
{% endif %}
{% endfor %}

View file

@ -3,6 +3,8 @@ layout: page
# The Category layout
---
{% include lang.html %}
<div id="page-category">
<h1 class="pl-lg-2">
<i class="far fa-folder-open fa-fw text-muted"></i>
@ -15,7 +17,7 @@ layout: page
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
{% include datetime.html date=post.date wrap='span' class='text-muted small' %}
{% include datetime.html date=post.date wrap='span' class='text-muted small' lang=lang %}
</li>
{% endfor %}
</ul>

View file

@ -3,10 +3,12 @@ layout: compress
# Default layout
---
<!DOCTYPE html>
<!doctype html>
{% include assets-origin.html %}
{% include lang.html %}
{% capture prefer_mode %}
{% if site.theme_mode %}
data-mode="{{ site.theme_mode }}"
@ -14,26 +16,24 @@ layout: compress
{% endcapture %}
<!-- `site.alt_lang` can specify a language different from the UI -->
<html lang="{{ site.alt_lang | default: site.lang }}"{{ prefer_mode }}>
<html lang="{{ site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
{% include head.html %}
<body data-topbar-visible="true">
{% include sidebar.html lang=lang %}
{% include sidebar.html %}
{% include topbar.html %}
{% include topbar.html lang=lang %}
<div id="main-wrapper" class="d-flex justify-content-center">
<div id="main" class="container pl-xl-4 pr-xl-4">
{{ content }}
</div>
{% include search-results.html %}
{% include search-results.html lang=lang %}
</div>
<!-- #main-wrapper -->
</div> <!-- #main-wrapper -->
{% include footer.html %}
{% include footer.html lang=lang %}
{% if page.mermaid %}
{% include mermaid.html %}
@ -46,17 +46,24 @@ layout: compress
</a>
{% if site.pwa.enabled %}
<div id="notification" class="toast" role="alert" aria-live="assertive" aria-atomic="true"
data-animation="true" data-autohide="false">
<div
id="notification"
class="toast"
role="alert"
aria-live="assertive"
aria-atomic="true"
data-animation="true"
data-autohide="false"
>
<div class="toast-header">
<button type="button" class="ml-2 ml-auto close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body text-center pt-0">
<p class="pl-2 pr-2 mb-3">{{ site.data.locales[site.lang].notification.update_found }}</p>
<p class="pl-2 pr-2 mb-3">{{ site.data.locales[lang].notification.update_found }}</p>
<button type="button" class="btn btn-primary" aria-label="Update">
{{ site.data.locales[site.lang].notification.update }}
{{ site.data.locales[lang].notification.update }}
</button>
</div>
</div>
@ -65,7 +72,5 @@ layout: compress
{% include search-loader.html %}
{% include js-selector.html %}
</body>
</html>

View file

@ -3,6 +3,8 @@ layout: page
# The Home page layout
---
{% include lang.html %}
{% assign pinned = site.posts | where: 'pin', 'true' %}
{% assign default = site.posts | where_exp: 'item', 'item.pin != true and item.hidden != true' %}
@ -58,7 +60,7 @@ layout: page
<div class="mr-auto">
<!-- posted date -->
<i class="far fa-calendar fa-fw"></i>
{% include datetime.html date=post.date %}
{% include datetime.html date=post.date lang=lang %}
<!-- categories -->
{% if post.categories.size > 0 %}
@ -75,7 +77,7 @@ layout: page
{% if post.pin %}
<div class="pin">
<i class="fas fa-thumbtack fa-fw"></i>
<span>{{ site.data.locales[site.lang].post.pin_prompt }}</span>
<span>{{ site.data.locales[lang].post.pin_prompt }}</span>
</div>
{% endif %}
</div>

View file

@ -4,15 +4,15 @@ layout: default
{% include assets-origin.html %}
<div class="row">
{% include lang.html %}
<div class="row">
<!-- core -->
<div id="core-wrapper" class="col-12 col-lg-11 col-xl-9 pr-xl-4">
<div class="post pl-1 pr-1 pl-md-2 pr-md-2">
{% capture _content %}
{% if layout.refactor or page.layout == 'page' %}
{% include refactor-content.html content=content %}
{% include refactor-content.html content=content lang=lang %}
{% else %}
{{ content }}
{% endif %}
@ -20,7 +20,7 @@ layout: default
{% if page.layout == 'page' or page.collection == 'tabs' %}
{% assign tab_key = page.title | downcase %}
{% assign title = site.data.locales[site.lang].tabs[tab_key] | default: page.title %}
{% assign title = site.data.locales[lang].tabs[tab_key] | default: page.title %}
<h1 class="dynamic-title">
{{ title }}
</h1>
@ -30,34 +30,32 @@ layout: default
{% else %}
{{ _content }}
{% endif %}
</div>
</div> <!-- #core-wrapper -->
</div>
<!-- #core-wrapper -->
<!-- panel -->
<div id="panel-wrapper" class="col-xl-3 pl-2 text-muted">
<div class="access">
{% include update-list.html %}
{% include trending-tags.html %}
{% include update-list.html lang=lang %}
{% include trending-tags.html lang=lang %}
</div>
{% for _include in layout.panel_includes %}
{% assign _include_path = _include | append: '.html' %}
{% include {{ _include_path }} %}
{% include {{ _include_path }} lang=lang %}
{% endfor %}
</div>
</div>
<!-- tail -->
{% if layout.tail_includes %}
<div class="row">
<div class="row">
<div id="tail-wrapper" class="col-12 col-lg-11 col-xl-9 pl-3 pr-3 pr-xl-4 mt-5">
{% for _include in layout.tail_includes %}
{% assign _include_path = _include | append: '.html' %}
{% include {{ _include_path }} %}
{% include {{ _include_path }} lang=lang %}
{% endfor %}
</div>
</div>
</div>
{% endif %}

View file

@ -9,20 +9,22 @@ tail_includes:
- comments
---
{% include lang.html %}
<h1 data-toc-skip>{{ page.title }}</h1>
<div class="post-meta text-muted">
<!-- published date -->
<span>
{{ site.data.locales[site.lang].post.posted }}
{% include datetime.html date=page.date tooltip=true %}
{{ site.data.locales[lang].post.posted }}
{% include datetime.html date=page.date tooltip=true lang=lang %}
</span>
<!-- lastmod date -->
{% if page.last_modified_at %}
<span>
{{ site.data.locales[site.lang].post.updated }}
{% include datetime.html date=page.last_modified_at tooltip=true %}
{{ site.data.locales[lang].post.updated }}
{% include datetime.html date=page.last_modified_at tooltip=true lang=lang %}
</span>
{% endif %}
@ -54,7 +56,7 @@ tail_includes:
{% assign authors = page.authors %}
{% endif %}
{{ site.data.locales[site.lang].post.written_by }}
{{ site.data.locales[lang].post.written_by }}
<em>
{% if authors %}
@ -75,12 +77,12 @@ tail_includes:
<em id="pv" class="pageviews">
<i class="fas fa-spinner fa-spin fa-fw"></i>
</em>
{{ site.data.locales[site.lang].post.pageview_measure }}
{{ site.data.locales[lang].post.pageview_measure }}
</span>
{% endif %}
<!-- read time -->
{% include read-time.html content=content prompt=true %}
{% include read-time.html content=content prompt=true lang=lang %}
</div>
</div> <!-- .d-flex -->
@ -121,20 +123,20 @@ tail_includes:
d-flex justify-content-between align-items-center mt-3 pt-5 pb-2">
<div class="license-wrapper">
{% if site.data.locales[site.lang].copyright.license.template %}
{% if site.data.locales[lang].copyright.license.template %}
{% capture _replacement %}
<a href="{{ site.data.locales[site.lang].copyright.license.link }}">
{{ site.data.locales[site.lang].copyright.license.name }}
<a href="{{ site.data.locales[lang].copyright.license.link }}">
{{ site.data.locales[lang].copyright.license.name }}
</a>
{% endcapture %}
{{ site.data.locales[site.lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
{{ site.data.locales[lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
{% endif %}
</div>
{% include post-sharing.html %}
{% include post-sharing.html lang=lang %}
</div><!-- .post-tail-bottom -->

View file

@ -3,6 +3,8 @@ layout: page
# The layout for Tag page
---
{% include lang.html %}
<div id="page-tag">
<h1 class="pl-lg-2">
<i class="fa fa-tag fa-fw text-muted"></i>
@ -14,7 +16,7 @@ layout: page
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
{% include datetime.html date=post.date wrap='span' class='text-muted small' %}
{% include datetime.html date=post.date wrap='span' class='text-muted small' lang=lang %}
</li>
{% endfor %}
</ul>

View file

@ -9,6 +9,8 @@ redirect_from:
- /posts/
---
{% include lang.html %}
<div class="lead">
<p>{{site.data.locales[site.lang].not_found.statment }}</p>
<p>{{ site.data.locales[lang].not_found.statment }}</p>
</div>