From 03d81f078567f1a7023c000fb5911f0fb8eae09d Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Sun, 31 May 2026 12:16:49 +0800 Subject: [PATCH] feat(assets): improve comment system config and lang mapping (#773) * feat(Artalk): add missing Artalk config options and remove deprecated useBackendConf * fix(Twikoo): improve lang config with proper fallback mapping * refactor(assets): unify comment system lang config with inline mapping Replace i18n-based lang translation (valineLang, facebookLanguageCode) with inline mapping for Valine, Facebook, and Twikoo. Fixes: ja incorrectly mapped to zh-cn in Valine. --- hugo.toml | 27 +++++++++-- i18n/de.toml | 2 - i18n/en.toml | 2 - i18n/es.toml | 2 - i18n/fr.toml | 2 - i18n/hi.toml | 2 - i18n/it.toml | 2 - i18n/ja.toml | 2 - i18n/ko.toml | 2 - i18n/pl.toml | 2 - i18n/pt-BR.toml | 2 - i18n/ro.toml | 2 - i18n/ru.toml | 2 - i18n/sr.toml | 2 - i18n/vi.toml | 2 - i18n/zh-CN.toml | 2 - i18n/zh-TW.toml | 2 - layouts/_partials/base/comment.html | 69 ++++++++++++++++++++++++----- 18 files changed, 80 insertions(+), 48 deletions(-) diff --git a/hugo.toml b/hugo.toml index 426f8d34..b7d11050 100644 --- a/hugo.toml +++ b/hugo.toml @@ -1534,8 +1534,9 @@ enable = false enable = false server = "https://yourdomain" site = "默认站点" -# FixIt 0.3.3 | NEW whether use backend configuration -useBackendConf = false +# FixIt 1.0.0 | NEW prefer remote (backend) configuration over local +# If true, remote config takes priority; if false (default), local config overrides remote +preferRemoteConf = false placeholder = "" noComment = "" sendBtn = "" @@ -1543,8 +1544,7 @@ editorTravel = true flatMode = "auto" # FixIt 0.2.17 | CHANGED enable lightgallery support lightgallery = false -locale = "" # FixIt 0.2.15 | NEW -# FixIt 0.2.18 | NEW +locale = "" emoticons = "" nestMax = 2 nestSort = "DATE_ASC" # ["DATE_ASC", "DATE_DESC", "VOTE_UP_DESC"] @@ -1552,9 +1552,27 @@ vote = true voteDown = false uaBadge = true listSort = true +listUnreadHighlight = false imgUpload = true +imgLazyLoad = false # false | "native" | "data-src" preview = true versionCheck = true +# request timeout in milliseconds +reqTimeout = 15000 +# page view increment on comment list load +pvAdd = true + +# FixIt 1.0.0 | NEW pagination config +[params.page.comment.artalk.pagination] +pageSize = 20 +readMore = true +autoLoad = true + +# FixIt 1.0.0 | NEW height limit config +[params.page.comment.artalk.heightLimit] +content = 300 +children = 400 +scrollable = false # Disqus comment config (https://disqus.com) [params.page.comment.disqus] @@ -1665,6 +1683,7 @@ region = "" path = "" visitor = true commentCount = true +lang = "" # FixIt 0.2.17 | CHANGED enable lightgallery support lightgallery = false # FixIt 0.2.17 | NEW enable Katex support diff --git a/i18n/de.toml b/i18n/de.toml index e49ab06f..66258081 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -84,9 +84,7 @@ siteRunning = "Website läuft ..." # === Comment === [comment] -valineLang = "en" # Deutsch unterstützt Valine nicht valinePlaceholder = "Ihr Kommentar ..." -facebookLanguageCode = "de_DE" # === Comment === # === Assets === diff --git a/i18n/en.toml b/i18n/en.toml index 0bf10f79..24deb72c 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -84,9 +84,7 @@ siteRunning = "Website running ..." # === Comment === [comment] -valineLang = "en" valinePlaceholder = "Your comment ..." -facebookLanguageCode = "en_US" # === Comment === # === Assets === diff --git a/i18n/es.toml b/i18n/es.toml index 9f2d3fcd..f4a76655 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -84,9 +84,7 @@ siteRunning = "El sitio se está ejecutando ..." # === Comment === [comment] -valineLang = "en" # Español no soportado por Valine valinePlaceholder = "Tu comentario ..." -facebookLanguageCode = "es_MX" # === Comment === # === Assets === diff --git a/i18n/fr.toml b/i18n/fr.toml index cf862785..a359165b 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -84,9 +84,7 @@ siteRunning = "Site en cours d'exécution ..." # === Comment === [comment] -valineLang = "en" # French not supported by Valine valinePlaceholder = "Votre commentaire ..." -facebookLanguageCode = "fr" # === Comment === # === Assets === diff --git a/i18n/hi.toml b/i18n/hi.toml index 85b4c065..3673f193 100644 --- a/i18n/hi.toml +++ b/i18n/hi.toml @@ -85,9 +85,7 @@ siteRunning = "वेबसाइट चल रही है ..." # === Comment === [comment] -valineLang = "hi" valinePlaceholder = "आपकी टिप्पणी ..." -facebookLanguageCode = "hi" # === Comment === # === Assets === diff --git a/i18n/it.toml b/i18n/it.toml index 6b4030ac..fe7c9e80 100644 --- a/i18n/it.toml +++ b/i18n/it.toml @@ -84,9 +84,7 @@ siteRunning = "Sito in esecuzione ..." # === Comment === [comment] -valineLang = "en" # Valine non supporta l'italiano valinePlaceholder = "Il tuo commento ..." -facebookLanguageCode = "it" # === Comment === # === Assets === diff --git a/i18n/ja.toml b/i18n/ja.toml index 5ed1fd99..defb7211 100644 --- a/i18n/ja.toml +++ b/i18n/ja.toml @@ -82,9 +82,7 @@ siteRunning = "サイトが実行中……" # === Comment === [comment] -valineLang = "zh-cn" valinePlaceholder = "あなたのコメント……" -facebookLanguageCode = "zh_CN" # === Comment === # === Assets === diff --git a/i18n/ko.toml b/i18n/ko.toml index 7c1c2801..44b74ad1 100644 --- a/i18n/ko.toml +++ b/i18n/ko.toml @@ -82,9 +82,7 @@ siteRunning = "사이트 운영 중……" # === Comment === [comment] -valineLang = "ko" valinePlaceholder = "당신의 댓글……" -facebookLanguageCode = "ko_KR" # === Comment === # === Assets === diff --git a/i18n/pl.toml b/i18n/pl.toml index 178d5709..d0a25d05 100644 --- a/i18n/pl.toml +++ b/i18n/pl.toml @@ -84,9 +84,7 @@ siteRunning = "Website running ..." # === Comment === [comment] -valineLang = "en" # Valine nie obsługuje języka polskiego valinePlaceholder = "Twój komentarz ..." -facebookLanguageCode = "pl" # === Comment === # === Assets === diff --git a/i18n/pt-BR.toml b/i18n/pt-BR.toml index b4884481..fb33aa23 100644 --- a/i18n/pt-BR.toml +++ b/i18n/pt-BR.toml @@ -85,9 +85,7 @@ siteRunning = "Site no ar..." # === Comment === [comment] -valineLang = "en" # Valine não suporta português valinePlaceholder = "O seu comentário..." -facebookLanguageCode = "pt_BR" # === Comment === # === Assets === diff --git a/i18n/ro.toml b/i18n/ro.toml index bba864d1..ec3f29ba 100644 --- a/i18n/ro.toml +++ b/i18n/ro.toml @@ -84,9 +84,7 @@ siteRunning = "Site-ul rulează ..." # === Comment === [comment] -valineLang = "en" # Valine nu suporta romana valinePlaceholder = "Comentariul dvs ..." -facebookLanguageCode = "ro_RO" # === Comment === # === Assets === diff --git a/i18n/ru.toml b/i18n/ru.toml index 01e789af..6edea579 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -84,9 +84,7 @@ siteRunning = "Website running ..." # === Comment === [comment] -valineLang = "en" # Valine не поддерживает русский valinePlaceholder = "Ваш комментарий ..." -facebookLanguageCode = "ru_RU" # === Comment === # === Assets === diff --git a/i18n/sr.toml b/i18n/sr.toml index b8fdf2de..a394aee6 100644 --- a/i18n/sr.toml +++ b/i18n/sr.toml @@ -84,9 +84,7 @@ siteRunning = "Website running ..." # === Comment === [comment] -valineLang = "sr" # Valine не подржава српски valinePlaceholder = "Ваш коментар ..." -facebookLanguageCode = "sr_RS" # === Comment === # === Assets === diff --git a/i18n/vi.toml b/i18n/vi.toml index 38a57fa9..15f54c0d 100644 --- a/i18n/vi.toml +++ b/i18n/vi.toml @@ -83,9 +83,7 @@ siteRunning = "Trang web đang chạy ..." # === Comment === [comment] -valineLang = "en" # Valine không hỗ trợ tiếng Việt valinePlaceholder = "Bình luận của bạn ..." -facebookLanguageCode = "vi" # === Comment === # === Assets === diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml index 188b0bac..f5f81518 100644 --- a/i18n/zh-CN.toml +++ b/i18n/zh-CN.toml @@ -82,9 +82,7 @@ siteRunning = "网站运行中……" # === Comment === [comment] -valineLang = "zh-cn" valinePlaceholder = "你的评论……" -facebookLanguageCode = "zh_CN" # === Comment === # === Assets === diff --git a/i18n/zh-TW.toml b/i18n/zh-TW.toml index 35494c16..6ea132d2 100644 --- a/i18n/zh-TW.toml +++ b/i18n/zh-TW.toml @@ -82,9 +82,7 @@ siteRunning = "網站運行中……" # === Comment === [comment] -valineLang = "zh-TW" valinePlaceholder = "你的評論……" -facebookLanguageCode = "zh-TW" # === Comment === # === Assets === diff --git a/layouts/_partials/base/comment.html b/layouts/_partials/base/comment.html index 72851878..09ceddd4 100644 --- a/layouts/_partials/base/comment.html +++ b/layouts/_partials/base/comment.html @@ -7,11 +7,6 @@ {{- $commentConfig = dict "enable" true "expired" (.Store.Get "commentExpired" | default false) -}}