{% for item in update_list %} {% assign index = item | split: "::" | last | plus: 0 %} diff --git a/_javascript/utils/locale-datetime.js b/_javascript/utils/locale-datetime.js index 571dd0f..219c5e8 100644 --- a/_javascript/utils/locale-datetime.js +++ b/_javascript/utils/locale-datetime.js @@ -6,9 +6,7 @@ /* A tool for locale datetime */ const LocaleHelper = (function () { - const $preferLocale = $('meta[name="prefer-datetime-locale"]'); - const locale = $preferLocale.length > 0 ? - $preferLocale.attr('content').toLowerCase() : $('html').attr('lang').substr(0, 2); + const locale = $('html').attr('lang').substr(0, 2) const attrTimestamp = 'data-ts'; const attrDateFormat = 'data-df'; diff --git a/_layouts/archives.html b/_layouts/archives.html index 61ad91d..f86b417 100644 --- a/_layouts/archives.html +++ b/_layouts/archives.html @@ -3,15 +3,8 @@ layout: page # The Archives of posts. --- -{% include lang.html %} - -{% if site.prefer_datetime_locale == 'en' or lang == 'en' %} - {% assign df_strftime_m = '%b' %} - {% assign df_dayjs_m = 'MMM' %} -{% else %} - {% assign df_strftime_m = '/ %m' %} - {% assign df_dayjs_m = '/ MM' %} -{% endif %} +{% 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' %}
    diff --git a/_layouts/categories.html b/_layouts/categories.html index 88c45b0..b207186 100644 --- a/_layouts/categories.html +++ b/_layouts/categories.html @@ -3,8 +3,6 @@ layout: page # All the Categories of posts --- -{% include lang.html %} - {% assign HEAD_PREFIX = "h_" %} {% assign LIST_PREFIX = "l_" %} @@ -48,22 +46,22 @@ layout: page {% if sub_categories_size > 0 %} {{ sub_categories_size }} {% if sub_categories_size > 1 %} - {{ site.data.locales[lang].categories.category_measure.plural - | default: site.data.locales[lang].categories.category_measure }} + {{ site.data.locales[site.lang].categories.category_measure.plural + | default: site.data.locales[site.lang].categories.category_measure }} {% else %} - {{ site.data.locales[lang].categories.category_measure.singular - | default: site.data.locales[lang].categories.category_measure }} + {{ site.data.locales[site.lang].categories.category_measure.singular + | default: site.data.locales[site.lang].categories.category_measure }} {% endif %}, {% endif %} {{ top_posts_size }} {% if top_posts_size > 1 %} - {{ site.data.locales[lang].categories.post_measure.plural - | default: site.data.locales[lang].categories.post_measure }} + {{ site.data.locales[site.lang].categories.post_measure.plural + | default: site.data.locales[site.lang].categories.post_measure }} {% else %} - {{ site.data.locales[lang].categories.post_measure.singular - | default: site.data.locales[lang].categories.post_measure }} + {{ site.data.locales[site.lang].categories.post_measure.singular + | default: site.data.locales[site.lang].categories.post_measure }} {% endif %} @@ -99,11 +97,11 @@ layout: page {{ posts_size }} {% if posts_size > 1 %} - {{ site.data.locales[lang].categories.post_measure.plural - | default: site.data.locales[lang].categories.post_measure }} + {{ site.data.locales[site.lang].categories.post_measure.plural + | default: site.data.locales[site.lang].categories.post_measure }} {% else %} - {{ site.data.locales[lang].categories.post_measure.singular - | default: site.data.locales[lang].categories.post_measure }} + {{ site.data.locales[site.lang].categories.post_measure.singular + | default: site.data.locales[site.lang].categories.post_measure }} {% endif %} diff --git a/_layouts/category.html b/_layouts/category.html index f6ceb5a..07129bb 100644 --- a/_layouts/category.html +++ b/_layouts/category.html @@ -3,8 +3,6 @@ layout: page # The Category layout --- -{% include lang.html %} -

    diff --git a/_layouts/default.html b/_layouts/default.html index 55385a3..6d1b0a5 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -5,8 +5,6 @@ layout: compress -{% include lang.html %} - {% include assets-origin.html %} {% capture prefer_mode %} @@ -15,7 +13,8 @@ layout: compress {% endif %} {% endcapture %} - + + {% include head.html %} @@ -55,9 +54,9 @@ layout: compress

    -

    {{ site.data.locales[lang].notification.update_found }}

    +

    {{ site.data.locales[site.lang].notification.update_found }}

    diff --git a/_layouts/home.html b/_layouts/home.html index 903573b..9d9eae3 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -3,8 +3,6 @@ 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" %} @@ -79,7 +77,7 @@ layout: page {% if post.pin %}
    - {{ site.data.locales[lang].post.pin_prompt }} + {{ site.data.locales[site.lang].post.pin_prompt }}
    {% endif %} diff --git a/_layouts/page.html b/_layouts/page.html index 2b9b6e5..4285c85 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -2,8 +2,6 @@ layout: default --- -{% include lang.html %} - {% include assets-origin.html %}
    @@ -22,7 +20,7 @@ layout: default {% if page.layout == 'page' or page.collection == 'tabs' %} {% assign tab_key = page.title | downcase %} - {% assign title = site.data.locales[lang].tabs[tab_key] | default: page.title %} + {% assign title = site.data.locales[site.lang].tabs[tab_key] | default: page.title %}

    {{ title }}

    diff --git a/_layouts/post.html b/_layouts/post.html index e3d922c..44de48a 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -9,21 +9,19 @@ tail_includes: - comments --- -{% include lang.html %} -

    {{ page.title }}