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:
parent
6846c897ef
commit
7f33f8239e
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -45,7 +45,7 @@ jobs:
|
|||||||
- uses: robinraju/release-downloader@v1
|
- uses: robinraju/release-downloader@v1
|
||||||
with:
|
with:
|
||||||
repository: nezhahq/user-frontend
|
repository: nezhahq/user-frontend
|
||||||
tag: v1.0.6
|
tag: v1.0.7
|
||||||
fileName: dist.zip
|
fileName: dist.zip
|
||||||
latest: true
|
latest: true
|
||||||
extract: true
|
extract: true
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/nezhahq/nezha/pkg/i18n"
|
"github.com/nezhahq/nezha/pkg/i18n"
|
||||||
)
|
)
|
||||||
@ -25,6 +26,7 @@ func loadTranslation() error {
|
|||||||
lang = "zh_CN"
|
lang = "zh_CN"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lang = strings.Replace(lang, "-", "_", 1)
|
||||||
data, err := getTranslationArchive(lang)
|
data, err := getTranslationArchive(lang)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -35,6 +37,7 @@ func loadTranslation() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func OnUpdateLang(lang string) error {
|
func OnUpdateLang(lang string) error {
|
||||||
|
lang = strings.Replace(lang, "-", "_", 1)
|
||||||
if Localizer.Exists(lang) {
|
if Localizer.Exists(lang) {
|
||||||
Localizer.SetLanguage(lang)
|
Localizer.SetLanguage(lang)
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user