commands: initialize locale on startup

As the first thing we do when we run a command, let's initialize the
locale.  This will let us print any sort of error or warning messages in
the user's preferred language if we have any problems.
This commit is contained in:
brian m. carlson 2021-11-09 21:20:23 +00:00
parent 182ed28852
commit 7e51166aa0
No known key found for this signature in database
GPG Key ID: 2D0C9BC12F82B3A1

@ -11,6 +11,7 @@ import (
"github.com/git-lfs/git-lfs/v3/config"
"github.com/git-lfs/git-lfs/v3/tools"
"github.com/git-lfs/git-lfs/v3/tr"
"github.com/spf13/cobra"
)
@ -56,6 +57,7 @@ func RegisterCommand(name string, runFn func(cmd *cobra.Command, args []string),
// It returns an exit code.
func Run() int {
log.SetOutput(ErrorWriter)
tr.InitializeLocale()
root := NewCommand("git-lfs", gitlfsCommand)
root.PreRun = nil