Skip to content

Commit

Permalink
Fixed locales (translations) not being detected with default config
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Oct 7, 2024
1 parent ac6ec6d commit 5ba6901
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 0 additions & 1 deletion commands/service_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func TestGetAll(t *testing.T) {
"user": `+defaultUserDir.GetEncodedValue()+`
},
"library": {},
"locale": "en",
"logging": {
"format": "text",
"level": "info"
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/configuration/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions internal/integrationtest/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit 5ba6901

Please sign in to comment.