Skip to content

Commit 6bf0ca9

Browse files
committed
Apply i18n settings only if specified
1 parent be7d2aa commit 6bf0ca9

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Diff for: commands/instances.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,9 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
419419
// Refreshes the locale used, this will change the
420420
// language of the CLI if the locale is different
421421
// after started.
422-
i18n.Init(s.settings.GetString("locale"))
422+
if locale, ok, _ := s.settings.GetStringOk("locale"); ok {
423+
i18n.Init(locale)
424+
}
423425

424426
return nil
425427
}

Diff for: commands/service.go

+1-7
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,14 @@ import (
1919
"context"
2020

2121
"github.com/arduino/arduino-cli/internal/cli/configuration"
22-
"github.com/arduino/arduino-cli/internal/i18n"
2322
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
2423
"github.com/arduino/arduino-cli/version"
2524
)
2625

2726
// NewArduinoCoreServer returns an implementation of the ArduinoCoreService gRPC service
2827
// that uses the provided version string.
2928
func NewArduinoCoreServer() rpc.ArduinoCoreServiceServer {
30-
settings := configuration.NewSettings()
31-
32-
// Setup i18n
33-
i18n.Init(settings.Locale())
34-
35-
return &arduinoCoreServerImpl{settings: settings}
29+
return &arduinoCoreServerImpl{settings: configuration.NewSettings()}
3630
}
3731

3832
type arduinoCoreServerImpl struct {

0 commit comments

Comments
 (0)