refactor(locale): restore options for changing date format (#716)

This commit is contained in:
Cotes Chung 2022-10-19 02:49:31 +08:00
parent 81b9f7a9ac
commit f904e8cd48
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
5 changed files with 28 additions and 15 deletions

View file

@ -73,6 +73,16 @@ post:
# pinned prompt of posts list on homepage
pin_prompt: Pinned
# Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df:
post:
strftime: '%b %e, %Y'
dayjs: 'll'
archives:
strftime: '%b'
dayjs: 'MMM'
# categories page
categories:
category_measure:

View file

@ -73,6 +73,13 @@ post:
# pinned prompt of posts list on homepage
pin_prompt:
# Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df:
post:
strftime: '%Y/%m/%d'
dayjs: 'YYYY/MM/DD'
# categories page
categories:
category_measure: 카테고리

View file

@ -72,6 +72,13 @@ post:
# pinned prompt of posts list on homepage
pin_prompt: 顶置
# Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df:
post:
strftime: '%Y/%m/%d'
dayjs: 'YYYY/MM/DD'
# categories page
categories:
category_measure: 个分类

View file

@ -4,14 +4,8 @@
-->
{% assign wrap_elem = include.wrap | default: 'em' %}
{% if site.prefer_datetime_locale == 'en' or lang == 'en' %}
{% assign df_strftime = '%b %e, %Y' %}
{% assign df_dayjs = 'll' %}
{% else %}
{% assign df_strftime = '%F' %}
{% assign df_dayjs = 'YYYY-MM-DD' %}
{% endif %}
{% assign df_strftime = site.data.locales[lang].df.post.strftime | default: '%d/%m/%Y' %}
{% assign df_dayjs = site.data.locales[lang].df.post.dayjs | default: 'DD/MM/YYYY' %}
<{{ wrap_elem }} class="{% if include.class %}{{ include.class }}{% endif %}"
data-ts="{{ include.date | date: '%s' }}"

View file

@ -5,13 +5,8 @@ layout: page
{% 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[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">