Set view titles in configureViewProperties rather than createAllViews

This ensures that they are updated to the new language when changing the
language in the config while lazygit is running.
This commit is contained in:
Stefan Haller 2025-03-05 14:50:08 +01:00
parent 1213e875bb
commit 8c014641d1
2 changed files with 32 additions and 44 deletions

View file

@ -424,6 +424,15 @@ func (gui *Gui) onUserConfigLoaded() error {
userConfig := gui.Config.GetUserConfig()
gui.Common.SetUserConfig(userConfig)
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
}
gui.setColorScheme()
gui.configureViewProperties()
@ -435,15 +444,6 @@ func (gui *Gui) onUserConfigLoaded() error {
gui.g.Mouse = userConfig.Gui.MouseEvents
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
}
// originally we could only hide the command log permanently via the config
// but now we do it via state. So we need to still support the config for the
// sake of backwards compatibility. We're making use of short circuiting here