Skip to content

Commit

Permalink
fix font loading error
Browse files Browse the repository at this point in the history
  • Loading branch information
libsgh committed Sep 18, 2024
1 parent 3cd40cb commit a02b8f6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions locale.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"embed"
"fmt"
"io"
"slices"

"github.com/BurntSushi/toml"
)
Expand All @@ -20,6 +21,9 @@ func DelayInitializeLocale() error {
}

func SetLocale(lan string) error {
if !slices.Contains([]string{"zh-CN", "en-US"}, lan) {
lan = "en-US"
}
langFile := fmt.Sprint("lang/", lan, ".toml")
fd, err := langFS.Open(langFile)
if err != nil {
Expand Down

0 comments on commit a02b8f6

Please sign in to comment.