1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-23 12:18:51 +02:00

Fix loading translation set json files on Windows

It seems that the embed.FS always uses foreward slashes, even on
Windows.

This not only affected generating the cheatsheets, but also loading a
translation file in production.
This commit is contained in:
stk 2024-06-30 10:41:48 +02:00
parent 6788825ed3
commit 398ceb1dd9

View File

@ -3,8 +3,8 @@ package i18n
import ( import (
"embed" "embed"
"encoding/json" "encoding/json"
"fmt"
"io/fs" "io/fs"
"path/filepath"
"strings" "strings"
"github.com/cloudfoundry/jibber_jabber" "github.com/cloudfoundry/jibber_jabber"
@ -83,7 +83,7 @@ func getSupportedLanguageCodes() ([]string, error) {
} }
func readLanguageFile(languageCode string) (*TranslationSet, error) { func readLanguageFile(languageCode string) (*TranslationSet, error) {
jsonData, err := embedFS.ReadFile(filepath.Join("translations", languageCode+".json")) jsonData, err := embedFS.ReadFile(fmt.Sprintf("translations/%s.json", languageCode))
if err != nil { if err != nil {
return nil, err return nil, err
} }