Make dates respect current locale (deprecations!)
And make comments use it in a smart way (it's not but it works) Deprecate "extra.date_format" and "extra.comments.locale" and replace it with "date_format" and "date_locale" in translation files
This commit is contained in:
18
config.toml
18
config.toml
@ -9,10 +9,15 @@ feed_filename = "atom.xml"
|
||||
build_search_index = false
|
||||
author = "Duck Quack"
|
||||
|
||||
# To translate the entire theme, there must be a file with the same ISO 639-1
|
||||
# (or IETF BCP 47) Code in the `i18n` folder of your site or the Duckquill theme
|
||||
# Based on https://github.com/welpo/tabi
|
||||
#
|
||||
# To translate the entire theme, there must be a file with the same ISO 639-1 or BCP 47
|
||||
# language code in the `i18n` directory of your site or the Duckquill theme.
|
||||
# For example, "i18n/fr.toml" for French or "i18n/zh-Hans.toml" for Simplified Chinese.
|
||||
# Otherwise the theme will be in English.
|
||||
#
|
||||
# ISO 639-1: https://localizely.com/iso-639-1-list/
|
||||
# BCP 47: https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
|
||||
default_language = "en"
|
||||
|
||||
taxonomies = [{ name = "tags", feed = true }]
|
||||
@ -51,11 +56,6 @@ primary_color_alpha = "rgba(255, 120, 0, 0.2)"
|
||||
emoji_favicon = false
|
||||
# Whether the favicon is an animated GIF or not
|
||||
animated_favicon = false
|
||||
# Tera Date format used when listing posts
|
||||
# (post publication date, tag posts list...).
|
||||
# Not used in comments.
|
||||
# See https://docs.rs/chrono/0.4.31/chrono/format/strftime/index.html
|
||||
date_format = "%d %B %Y"
|
||||
# URL to website's issue tracker
|
||||
issues_url = "https://codeberg.org/daudix/duckquill/issues"
|
||||
# URL to website's source code
|
||||
@ -134,10 +134,6 @@ host = "vmst.io"
|
||||
user = "daudix"
|
||||
# Whether to show the QR code to Mastodon post
|
||||
show_qr = true
|
||||
# BCP 47 locale used for comment timestamps;
|
||||
# See https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
|
||||
# Default: "en-IE"
|
||||
# locale = "YOUR_LOCALE"
|
||||
|
||||
# GoatCounter analytics; enabled only if present in config.
|
||||
[extra.goatcounter]
|
||||
|
3
content/demo/code.ar.md
Normal file
3
content/demo/code.ar.md
Normal file
@ -0,0 +1,3 @@
|
||||
+++
|
||||
title = "Code Block Demo (العربية)"
|
||||
+++
|
3
content/demo/code.ru.md
Normal file
3
content/demo/code.ru.md
Normal file
@ -0,0 +1,3 @@
|
||||
+++
|
||||
title = "Code Block Demo (Русский)"
|
||||
+++
|
8
content/demo/comments.ar.md
Normal file
8
content/demo/comments.ar.md
Normal file
@ -0,0 +1,8 @@
|
||||
+++
|
||||
template = "article.html"
|
||||
title = "ActivityPub/Fediverse comments demo (العربية)"
|
||||
[extra.comments]
|
||||
host = "toot.community"
|
||||
user = "sungsphinx"
|
||||
id = "111784580759701190"
|
||||
+++
|
8
content/demo/comments.ru.md
Normal file
8
content/demo/comments.ru.md
Normal file
@ -0,0 +1,8 @@
|
||||
+++
|
||||
template = "article.html"
|
||||
title = "ActivityPub/Fediverse comments demo (Русский)"
|
||||
[extra.comments]
|
||||
host = "toot.community"
|
||||
user = "sungsphinx"
|
||||
id = "111784580759701190"
|
||||
+++
|
4
content/demo/page.ar.md
Normal file
4
content/demo/page.ar.md
Normal file
@ -0,0 +1,4 @@
|
||||
+++
|
||||
+++
|
||||
|
||||
# Welcome to the cake party (العربية)
|
4
content/demo/page.ru.md
Normal file
4
content/demo/page.ru.md
Normal file
@ -0,0 +1,4 @@
|
||||
+++
|
||||
+++
|
||||
|
||||
# Welcome to the cake party (Русский)
|
15
i18n/ar.toml
15
i18n/ar.toml
@ -1,10 +1,11 @@
|
||||
# Hello, the Arabic language has many pronouns and words, and each word indicates a different meaning,
|
||||
# unlike the English language, in which, on the other hand, the word can refer to a person and a group.
|
||||
# This translation is for individual use, if you are a company or organization, I have put a comment in
|
||||
# front of each translation that refers to the person and the other word that refers to the organization
|
||||
|
||||
language_name = "العربية" # Shown in language picker for multi-language sites.
|
||||
date_locale = "ar-SA" # The locale code for time and date formatting.
|
||||
# Shown in language picker for multi-language sites
|
||||
language_name = "العربية"
|
||||
# Tera date format used for listing posts
|
||||
# (post publication date, tag posts list...).
|
||||
# Not used in comments, "date_locale" is used instead.
|
||||
# See https://docs.rs/chrono/0.4.31/chrono/format/strftime/index.html
|
||||
date_format = "%d %B %Y"
|
||||
date_locale = "ar_SA"
|
||||
|
||||
# Menu items.
|
||||
# Should match the names in config.extra.nav.links and config.extra.footer.links.
|
||||
|
10
i18n/en.toml
10
i18n/en.toml
@ -1,5 +1,11 @@
|
||||
language_name = "English" # Shown in language picker for multi-language sites.
|
||||
date_locale = "en-GB"
|
||||
# Shown in language picker for multi-language sites
|
||||
language_name = "English"
|
||||
# Tera date format used for listing posts
|
||||
# (post publication date, tag posts list...).
|
||||
# Not used in comments, "date_locale" is used instead.
|
||||
# See https://docs.rs/chrono/0.4.31/chrono/format/strftime/index.html
|
||||
date_format = "%d %B %Y"
|
||||
date_locale = "en_IE"
|
||||
|
||||
# Menu items.
|
||||
# Should match the names in config.extra.nav.links and config.extra.footer.links.
|
||||
|
10
i18n/ru.toml
10
i18n/ru.toml
@ -1,5 +1,11 @@
|
||||
language_name = "Русский" # Shown in language picker for multi-language sites.
|
||||
date_locale = "ru-RU"
|
||||
# Shown in language picker for multi-language sites
|
||||
language_name = "Русский"
|
||||
# Tera date format used for listing posts
|
||||
# (post publication date, tag posts list...).
|
||||
# Not used in comments, "date_locale" is used instead.
|
||||
# See https://docs.rs/chrono/0.4.31/chrono/format/strftime/index.html
|
||||
date_format = "%d %B %Y г."
|
||||
date_locale = "ru_RU"
|
||||
|
||||
# Note on pluralization prefixes:
|
||||
# - few_: for numbers ending in 2-4, except 12-14, in genitive singular.
|
||||
|
@ -1,13 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% set date_format = macros_translate::translate(key="date_format", default="%d %B %Y", language_strings=language_strings) %}
|
||||
{% set date_locale = macros_translate::translate(key="date_locale", default="en_IE", language_strings=language_strings) %}
|
||||
<article>
|
||||
<h1>{{ page.title }}</h1>
|
||||
|
||||
{%- if page.date %}
|
||||
<small>
|
||||
<time datetime="{{ page.date | date(format=' %+') }}" pubdate>
|
||||
{{- page.date | date(format=config.extra.date_format) -}}
|
||||
{{- page.date | date(format=date_format, locale=date_locale) -}}
|
||||
</time>
|
||||
{%- if page.authors %}
|
||||
<span>•</span>
|
||||
|
@ -1,6 +1,8 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% set date_format = macros_translate::translate(key="date_format", default="%d %B %Y", language_strings=language_strings) %}
|
||||
{% set date_locale = macros_translate::translate(key="date_locale", default="en_IE", language_strings=language_strings) %}
|
||||
<h1>{{ section.title }}</h1>
|
||||
|
||||
{{ section.description | markdown | safe }}
|
||||
@ -35,7 +37,7 @@
|
||||
{%- if page.date %}
|
||||
<small>
|
||||
<time datetime="{{ page.date | date(format='%+') }}" pubdate>
|
||||
{{- page.date | date(format=config.extra.date_format) -}}
|
||||
{{- page.date | date(format=date_format, locale=date_locale) -}}
|
||||
</time>
|
||||
{%- if page.authors %}
|
||||
<span>•</span>
|
||||
|
@ -13,7 +13,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% set id = page.extra.comments.id %}
|
||||
{% set date_locale = macros_translate::translate(key="date_locale", default="en-GB", language_strings=language_strings) %}
|
||||
{% set date_locale = macros_translate::translate(key="date_locale", default="en-IE", language_strings=language_strings) | replace(from="_", to="-") %}
|
||||
|
||||
<section id="comments">
|
||||
{% if config.extra.comments.show_qr %}
|
||||
|
@ -18,8 +18,7 @@
|
||||
{%- set other_language_strings = load_data(path="themes/tabi/i18n/" ~ lcode ~ ".toml", required=false) -%}
|
||||
{%- endif -%}
|
||||
{#- Use the loaded language strings to get the language name -#}
|
||||
{% set language_name = macros_translate::translate(key="language_name", default=lcode,
|
||||
language_strings=other_language_strings) %}
|
||||
{% set language_name = macros_translate::translate(key="language_name", default=lcode, language_strings=other_language_strings) %}
|
||||
{#- Check if the language code matches the default language -#}
|
||||
{%- if lcode == config.default_language -%}
|
||||
{#- If it does, link to the root path (no language code in URL) -#}
|
||||
|
@ -1,6 +1,8 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% set date_format = macros_translate::translate(key="date_format", default="%d %B %Y", language_strings=language_strings) %}
|
||||
{% set date_locale = macros_translate::translate(key="date_locale", default="en_IE", language_strings=language_strings) %}
|
||||
{% set number_of_posts = term.pages | length %}
|
||||
<h1>{{ macros_translate::translate(key="posts_with_tag", default="Posts with tag", language_strings=language_strings) }} “{{ term.name }}”</h1>
|
||||
|
||||
@ -34,7 +36,7 @@
|
||||
{%- if page.date %}
|
||||
<small>
|
||||
<time datetime="{{ page.date | date(format='%+') }}" pubdate>
|
||||
{{- page.date | date(format=config.extra.date_format) -}}
|
||||
{{- page.date | date(format=date_format, locale=date_locale) -}}
|
||||
</time>
|
||||
{%- if page.authors %}
|
||||
<span>•</span>
|
||||
|
@ -8,9 +8,6 @@ demo = "https://daudix.codeberg.page/duckquill"
|
||||
[extra]
|
||||
primary_color = "#9a9996"
|
||||
primary_color_alpha = "rgba(154, 153, 150, 0.2)"
|
||||
date_format = "%d %B %Y"
|
||||
issues_url = ""
|
||||
source_url = ""
|
||||
|
||||
[author]
|
||||
name = "David Lapshin"
|
||||
|
Reference in New Issue
Block a user