From 5ba690131a2088ec76cf5c85c771175b5d27c8b3 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Mon, 7 Oct 2024 18:32:04 +0200 Subject: [PATCH] Fixed locales (translations) not being detected with default config --- commands/service_settings_test.go | 1 - internal/cli/configuration/defaults.go | 2 +- internal/integrationtest/config/config_test.go | 13 +++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/commands/service_settings_test.go b/commands/service_settings_test.go index 1c77856a336..89f7b11c3f7 100644 --- a/commands/service_settings_test.go +++ b/commands/service_settings_test.go @@ -62,7 +62,6 @@ func TestGetAll(t *testing.T) { "user": `+defaultUserDir.GetEncodedValue()+` }, "library": {}, - "locale": "en", "logging": { "format": "text", "level": "info" diff --git a/internal/cli/configuration/defaults.go b/internal/cli/configuration/defaults.go index a810265785a..40f8b472cdb 100644 --- a/internal/cli/configuration/defaults.go +++ b/internal/cli/configuration/defaults.go @@ -73,7 +73,7 @@ func SetDefaults(settings *Settings) { setKeyTypeSchema("network.user_agent_ext", "") // locale - setDefaultValueAndKeyTypeSchema("locale", "en") + setKeyTypeSchema("locale", "") } // InjectEnvVars change settings based on the environment variables values diff --git a/internal/integrationtest/config/config_test.go b/internal/integrationtest/config/config_test.go index 6e57eebf72f..caf82d03934 100644 --- a/internal/integrationtest/config/config_test.go +++ b/internal/integrationtest/config/config_test.go @@ -931,3 +931,16 @@ func TestConfigViaEnvVars(t *testing.T) { require.NoError(t, err) require.Equal(t, "20\n\n", string(out)) } + +func TestI18N(t *testing.T) { + env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t) + defer env.CleanUp() + + out, _, err := cli.RunWithCustomEnv(map[string]string{"LANG": "it"}) + require.NoError(t, err) + require.Contains(t, string(out), "Comandi disponibili") + + out, _, err = cli.RunWithCustomEnv(map[string]string{"LANG": "en"}) + require.NoError(t, err) + require.Contains(t, string(out), "Available Commands") +}