Skip to content

Commit

Permalink
fixed embed path separator when loading languages
Browse files Browse the repository at this point in the history
  • Loading branch information
DrOctavius committed Jun 10, 2022
1 parent d781d4e commit f4c63f9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions language.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"embed"
"encoding/json"
"fmt"
"os"
"strconv"
"strings"
)
Expand Down Expand Up @@ -54,7 +53,10 @@ func (lang *Language) SetLocale(locale string) {
return
}
lang.locale = locale
fileName := lang.dir + string(os.PathSeparator) + locale + ".json"
//fileName := lang.dir + string(os.PathSeparator) + locale + ".json"
//fileName := lang.dir + filepath.FromSlash("/") + locale + ".json"
// embed path separator is /
fileName := lang.dir + "/" + locale + ".json"
bytes, err := fs.ReadFile(fileName)
if err != nil {
lang.Error = invalidLocaleError(fileName)
Expand Down

0 comments on commit f4c63f9

Please sign in to comment.