From 7f33f8239ebf0aaa54dff45aa5a030fee54ac187 Mon Sep 17 00:00:00 2001 From: UUBulb <35923940+uubulb@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:19:06 +0800 Subject: [PATCH] fix(i18n): replace hyphen with underscore (#524) * fix(i18n): repleace hyphen with underscore * chore: upgrade user frontend --------- Co-authored-by: naiba --- .github/workflows/release.yml | 2 +- service/singleton/i18n.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d174be..217ca8a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,7 +45,7 @@ jobs: - uses: robinraju/release-downloader@v1 with: repository: nezhahq/user-frontend - tag: v1.0.6 + tag: v1.0.7 fileName: dist.zip latest: true extract: true diff --git a/service/singleton/i18n.go b/service/singleton/i18n.go index d89c6c2..1adca0e 100644 --- a/service/singleton/i18n.go +++ b/service/singleton/i18n.go @@ -5,6 +5,7 @@ import ( "bytes" "fmt" "log" + "strings" "github.com/nezhahq/nezha/pkg/i18n" ) @@ -25,6 +26,7 @@ func loadTranslation() error { lang = "zh_CN" } + lang = strings.Replace(lang, "-", "_", 1) data, err := getTranslationArchive(lang) if err != nil { return err @@ -35,6 +37,7 @@ func loadTranslation() error { } func OnUpdateLang(lang string) error { + lang = strings.Replace(lang, "-", "_", 1) if Localizer.Exists(lang) { Localizer.SetLanguage(lang) return nil