From bdc500b14c60f8aea111ec81455b95aa8cce71d2 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Mon, 25 Apr 2022 11:29:57 +0800 Subject: [PATCH] :wrench: Chore(i18n): add i18n support for console messages --- CHANGELOG.md | 1 + i18n/de.toml | 18 ++++++++++++++++-- i18n/en.toml | 18 ++++++++++++++++-- i18n/es.toml | 18 ++++++++++++++++-- i18n/fr.toml | 18 ++++++++++++++++-- i18n/it.toml | 18 ++++++++++++++++-- i18n/pl.toml | 18 ++++++++++++++++-- i18n/pt-BR.toml | 18 ++++++++++++++++-- i18n/ro.toml | 18 ++++++++++++++++-- i18n/ru.toml | 18 ++++++++++++++++-- i18n/sr.toml | 18 ++++++++++++++++-- i18n/vi.toml | 18 ++++++++++++++++-- i18n/zh-CN.toml | 18 ++++++++++++++++-- i18n/zh-TW.toml | 18 ++++++++++++++++-- layouts/partials/init.html | 14 +++++++++----- package.json | 2 +- 16 files changed, 219 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38e7fa0e..5746fee7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ All notable changes to this project will be documented in this file. - :zap: Perf: remove third-party library clipboard.js ([#84](https://github.com/Lruihao/FixIt/issues/84)) - :pencil2: Docs: fix highlight url typo in `theme-documentation-built-in-shortcodes` (@d-baer[#85](https://github.com/Lruihao/FixIt/pull/85)) - :wrench: Chore(i18n): improve translations for supported languages ([#119](https://github.com/Lruihao/FixIt/issues/119)) +- :wrench: Chore(i18n): add i18n support for console messages - :wrench: Chore(deps-dev): - Bump minimist from 1.2.5 to 1.2.6 ([#92](https://github.com/Lruihao/FixIt/pull/92)) - Bump @babel/core from 7.17.5 to 7.17.9 ([#98](https://github.com/Lruihao/FixIt/pull/98)) diff --git a/i18n/de.toml b/i18n/de.toml index b8f8f0c4..aaa062ff 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -2,13 +2,27 @@ # Übersetzung auf Deutsch # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "" # waitting for translation + +[compatibilityError] +other = "" # waitting for translation + +[RCVersionWarn] +other = "" # waitting for translation + +[devEnvWarn] +other = "" # waitting for translation +# === init === + +# === baseof === [backToTop] other = "nach oben" [viewComments] other = "Kommentare anzeigen" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/en.toml b/i18n/en.toml index d90ea167..a92d9897 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -1,13 +1,27 @@ # Translations for English # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "Configuration Error\nYou haven't configured the FixIt version param correctly yet. See https://fixit.lruihao.cn/theme-documentation-basics/#basic-configuration" + +[compatibilityError] +other = "Compatibility Error ({{ .From }} -> {{ .To }}):\nYou have an incompatible update. See https://github.com/Lruihao/FixIt/releases" + +[RCVersionWarn] +other = "You are using a development version of FixIt. Please consider using a stable version.\nSee https://github.com/Lruihao/FixIt/releases" + +[devEnvWarn] +other = "Current environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled." +# === init === + +# === baseof === [backToTop] other = "Back to Top" [viewComments] other = "View Comments" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/es.toml b/i18n/es.toml index 2981faa4..cff45ff8 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -2,13 +2,27 @@ # Traducciones para español # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "" # waitting for translation + +[compatibilityError] +other = "" # waitting for translation + +[RCVersionWarn] +other = "" # waitting for translation + +[devEnvWarn] +other = "" # waitting for translation +# === init === + +# === baseof === [backToTop] other = "Volver arriba" [viewComments] other = "Ver comentarios" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/fr.toml b/i18n/fr.toml index 174fac19..26a8843b 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -2,13 +2,27 @@ # Traductions pour le français # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "" # waitting for translation + +[compatibilityError] +other = "" # waitting for translation + +[RCVersionWarn] +other = "" # waitting for translation + +[devEnvWarn] +other = "" # waitting for translation +# === init === + +# === baseof === [backToTop] other = "Retour en Haut" [viewComments] other = "Afficher les Commentaires" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/it.toml b/i18n/it.toml index 19470636..af59524c 100644 --- a/i18n/it.toml +++ b/i18n/it.toml @@ -2,13 +2,27 @@ # Traduzioni per l'italiano # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "" # waitting for translation + +[compatibilityError] +other = "" # waitting for translation + +[RCVersionWarn] +other = "" # waitting for translation + +[devEnvWarn] +other = "" # waitting for translation +# === init === + +# === baseof === [backToTop] other = "Torna all'inizio" [viewComments] other = "Vedi commenti" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/pl.toml b/i18n/pl.toml index 33b4f06f..a127086e 100644 --- a/i18n/pl.toml +++ b/i18n/pl.toml @@ -2,13 +2,27 @@ # Tłumaczenie na język polski # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "" # waitting for translation + +[compatibilityError] +other = "" # waitting for translation + +[RCVersionWarn] +other = "" # waitting for translation + +[devEnvWarn] +other = "" # waitting for translation +# === init === + +# === baseof === [backToTop] other = "Powrót do góry" [viewComments] other = "Zobacz komentarze" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/pt-BR.toml b/i18n/pt-BR.toml index cae88721..9e5a68e9 100644 --- a/i18n/pt-BR.toml +++ b/i18n/pt-BR.toml @@ -2,13 +2,27 @@ # Tradução para português do Brasil # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "" # waitting for translation + +[compatibilityError] +other = "" # waitting for translation + +[RCVersionWarn] +other = "" # waitting for translation + +[devEnvWarn] +other = "" # waitting for translation +# === init === + +# === baseof === [backToTop] other = "Voltar ao topo" [viewComments] other = "Ver comentários" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/ro.toml b/i18n/ro.toml index a04200d2..26e51bdf 100644 --- a/i18n/ro.toml +++ b/i18n/ro.toml @@ -2,13 +2,27 @@ # Traduceri pentru limba română # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "" # waitting for translation + +[compatibilityError] +other = "" # waitting for translation + +[RCVersionWarn] +other = "" # waitting for translation + +[devEnvWarn] +other = "" # waitting for translation +# === init === + +# === baseof === [backToTop] other = "Înapoi Sus" [viewComments] other = "Vizualizare Comentarii" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/ru.toml b/i18n/ru.toml index 44b5e56c..8a3a92ce 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -2,13 +2,27 @@ # Переводы на русский # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "" # waitting for translation + +[compatibilityError] +other = "" # waitting for translation + +[RCVersionWarn] +other = "" # waitting for translation + +[devEnvWarn] +other = "" # waitting for translation +# === init === + +# === baseof === [backToTop] other = "Наверх" [viewComments] other = "Посмотреть комментарии" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/sr.toml b/i18n/sr.toml index 8799bd2b..3e3d731a 100644 --- a/i18n/sr.toml +++ b/i18n/sr.toml @@ -2,13 +2,27 @@ # Превод на Српски # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "" # waitting for translation + +[compatibilityError] +other = "" # waitting for translation + +[RCVersionWarn] +other = "" # waitting for translation + +[devEnvWarn] +other = "" # waitting for translation +# === init === + +# === baseof === [backToTop] other = "Назад на Врх" [viewComments] other = "Погледај Коментаре" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/vi.toml b/i18n/vi.toml index e4cd678a..7c306dbd 100644 --- a/i18n/vi.toml +++ b/i18n/vi.toml @@ -1,13 +1,27 @@ # Translations for Vietnamese # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "" # waitting for translation + +[compatibilityError] +other = "" # waitting for translation + +[RCVersionWarn] +other = "" # waitting for translation + +[devEnvWarn] +other = "" # waitting for translation +# === init === + +# === baseof === [backToTop] other = "Lên trên" [viewComments] other = "Xem bình luận" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml index dc894c0f..448a695c 100644 --- a/i18n/zh-CN.toml +++ b/i18n/zh-CN.toml @@ -2,13 +2,27 @@ # 简体中文的翻译 # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "配置文件错误\n您还没有正确配置 FixIt 的版本参数。参考 https://fixit.lruihao.cn/zh-cn/theme-documentation-basics/#basic-configuration" + +[compatibilityError] +other = "兼容性错误 ({{ .From }} -> {{ .To }}):\n您进行了一次不兼容的更新。参考 https://github.com/Lruihao/FixIt/releases" + +[RCVersionWarn] +other = "您正在使用开发版的 FixIt,请考虑使用稳定版。\n见 https://github.com/Lruihao/FixIt/releases" + +[devEnvWarn] +other = "当前运行环境是“development”。“评论系统”,“CDN”和“fingerprint”不会启用。" +# === init === + +# === baseof === [backToTop] other = "回到顶部" [viewComments] other = "查看评论" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/i18n/zh-TW.toml b/i18n/zh-TW.toml index 7c533d45..b65d31a9 100644 --- a/i18n/zh-TW.toml +++ b/i18n/zh-TW.toml @@ -2,13 +2,27 @@ # 簡體中文的翻譯 # https://gohugo.io/content-management/multilingual/#translation-of-strings -# === baseof == +# === init === +[configurationError] +other = "配置文件錯誤\n您還沒有正確配置 FixIt 的版本參數。參考 https://fixit.lruihao.cn/zh-cn/theme-documentation-basics/#basic-configuration" + +[compatibilityError] +other = "兼容性錯誤 ({{ .From }} -> {{ .To }}):\n您進行了一次不兼容的更新。参考 https://github.com/Lruihao/FixIt/releases" + +[RCVersionWarn] +other = "您正在使用開發版的 FixIt,請考慮使用穩定版。\n見 https://github.com/Lruihao/FixIt/releases" + +[devEnvWarn] +other = "當前運行環境是“development”。“評論系統”,“CDN”和“fingerprint”不會啟用。" +# === init === + +# === baseof === [backToTop] other = "回到頂部" [viewComments] other = "查看評論" -# === baseof == +# === baseof === # === Post === [posts] diff --git a/layouts/partials/init.html b/layouts/partials/init.html index 6ca70c5c..60e36e6f 100644 --- a/layouts/partials/init.html +++ b/layouts/partials/init.html @@ -1,12 +1,15 @@ -{{- .Scratch.Set "version" "0.2.14" -}} +{{- $version := "v0.2.14-RC" -}} +{{- $VERSION := "0.2.X" -}} {{- /* FixIt theme version detection */ -}} -{{- $VERSION := "0.2.X" -}} {{- if eq .Site .Sites.First -}} + {{- if (strings.HasSuffix $version "RC") -}} + {{- warnf "FixIt %v\n%v" $version (T "RCVersionWarn") -}} + {{- end -}} {{- if not .Site.Params.version -}} - {{- errorf "Configuration Error 配置文件错误\n\nYou haven't configured the FixIt version param correctly yet. See https://hugoloveit.com/theme-documentation-basics/#basic-configuration\n你还没有正确配置 FixIt 的版本参数. 参考 https://hugoloveit.com/zh-cn/theme-documentation-basics/#basic-configuration\n" -}} + {{- errorf "FixIt %v\n%v" $version (T "configurationError") -}} {{- else if ne .Site.Params.version $VERSION -}} - {{- errorf (printf "Compatibility Error 兼容性错误\n\n%v -> %v:\nYou have an incompatible update. See https://github.com/Lruihao/FixIt/releases\n你进行了一次不兼容的更新. 参考 https://github.com/Lruihao/FixIt/releases\n" .Site.Params.version $VERSION) -}} + {{- errorf "FixIt %v\n%v" $version (dict "From" .Site.Params.version "To" $VERSION | T "compatibilityError") -}} {{- end -}} {{- end -}} @@ -38,9 +41,10 @@ {{- .Scratch.Set "comment" dict -}} {{- end -}} {{- else if eq .Site .Sites.First -}} - {{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}} + {{- warnf "FixIt %v\n%v" $version (T "devEnvWarn") -}} {{- end -}} +{{- .Scratch.Set "version" $version -}} {{- .Scratch.Set "params" $params -}} {{- .Scratch.Set "toc" $toc -}} {{- .Scratch.Set "this" dict -}} diff --git a/package.json b/package.json index fcdceae3..4c6b113d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fixit-src", - "version": "0.2.14", + "version": "0.2.14-RC", "description": "FixIt theme source files", "private": true, "dependencies": {},