fix(i18n): replace hyphen with underscore (#524)

* fix(i18n): repleace hyphen with underscore

* chore: upgrade user frontend

---------

Co-authored-by: naiba <hi@nai.ba>
This commit is contained in:
UUBulbandnaiba authored and GitHub committed 2024-12-01 23:19:06 +08:00
1 parent 6846c897ef
commit 7f33f8239e
2 files changed
+4 -1

No files matched your search

+3
View File
@@ -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