mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	Initialize translation set after reading user config
This allows having per-repo config files with different languages per repo. Now granted, this is not an important use case that we need to support; however, the goal is to eventually make all configs hot-reloadable (as opposed to loading them only once at startup), so this is one step in that direction.
This commit is contained in:
		| @@ -36,6 +36,7 @@ import ( | ||||
| 	"github.com/jesseduffield/lazygit/pkg/gui/status" | ||||
| 	"github.com/jesseduffield/lazygit/pkg/gui/style" | ||||
| 	"github.com/jesseduffield/lazygit/pkg/gui/types" | ||||
| 	"github.com/jesseduffield/lazygit/pkg/i18n" | ||||
| 	"github.com/jesseduffield/lazygit/pkg/integration/components" | ||||
| 	integrationTypes "github.com/jesseduffield/lazygit/pkg/integration/types" | ||||
| 	"github.com/jesseduffield/lazygit/pkg/tasks" | ||||
| @@ -138,6 +139,8 @@ type Gui struct { | ||||
| 	c       *helpers.HelperCommon | ||||
| 	helpers *helpers.Helpers | ||||
|  | ||||
| 	previousLanguageConfig string | ||||
|  | ||||
| 	integrationTest integrationTypes.IntegrationTest | ||||
|  | ||||
| 	afterLayoutFuncs chan func() error | ||||
| @@ -383,6 +386,15 @@ func (gui *Gui) onUserConfigLoaded() error { | ||||
| 	gui.setColorScheme() | ||||
| 	gui.configureViewProperties() | ||||
|  | ||||
| 	if gui.previousLanguageConfig != userConfig.Gui.Language { | ||||
| 		tr, err := i18n.NewTranslationSetFromConfig(gui.Log, userConfig.Gui.Language) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 		gui.c.Tr = tr | ||||
| 		gui.previousLanguageConfig = userConfig.Gui.Language | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user