1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-25 00:46:54 +02:00

Fix language auto-detection

Starting lazygit with an environment containing LANG=ko_KO or LANG=nl_NL would
result in an error at startup.
This commit is contained in:
Stefan Haller
2024-07-13 11:10:38 +02:00
parent da86096e19
commit ae4a579153
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ func NewTranslationSetFromConfig(log *logrus.Entry, configLanguage string) (*Tra
language := detectLanguage(jibber_jabber.DetectIETF)
for _, languageCode := range languageCodes {
if strings.HasPrefix(language, languageCode) {
return newTranslationSet(log, language)
return newTranslationSet(log, languageCode)
}
}

View File

@ -83,7 +83,7 @@ func TestNewTranslationSetFromConfig(t *testing.T) {
configLanguage: "auto",
envLanguage: "nl_NL",
expected: "nl",
expectedErr: true, // Demonstrates the bug, this should be false
expectedErr: false,
},
{
name: "auto-detection with LANG set to zh-CN",