From ae4a579153bbe799a785c27f956bca5be46e429c Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 13 Jul 2024 11:10:38 +0200 Subject: [PATCH] Fix language auto-detection Starting lazygit with an environment containing LANG=ko_KO or LANG=nl_NL would result in an error at startup. --- pkg/i18n/i18n.go | 2 +- pkg/i18n/i18n_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go index f9febbe01..3848d42cf 100644 --- a/pkg/i18n/i18n.go +++ b/pkg/i18n/i18n.go @@ -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) } } diff --git a/pkg/i18n/i18n_test.go b/pkg/i18n/i18n_test.go index 28b96bc4f..8c5787fcb 100644 --- a/pkg/i18n/i18n_test.go +++ b/pkg/i18n/i18n_test.go @@ -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",