Expose language setting in settings dialog, fix some bugs

This commit is contained in:
Drew Weymouth
2024-12-17 19:15:16 -08:00
parent dd3f5874c4
commit 34c04ba9d9
3 changed files with 33 additions and 5 deletions
+6 -2
View File
@@ -52,7 +52,7 @@ func main() {
return t.Name == myApp.Config.Application.Language
})
success := false
if lIdx > 0 {
if lIdx >= 0 {
tr := res.TranslationsInfo[lIdx]
content, err := res.Translations.ReadFile("translations/" + tr.TranslationFileName)
if err == nil {
@@ -61,10 +61,14 @@ func main() {
name := lang.SystemLocale().LanguageString()
lang.AddTranslations(fyne.NewStaticResource(name+".json", content))
success = true
} else {
log.Printf("Error loading translation file %s: %s\n", tr.TranslationFileName, err.Error())
}
}
if !success {
lang.AddTranslationsFS(res.Translations, "translations")
if err := lang.AddTranslationsFS(res.Translations, "translations"); err != nil {
log.Printf("Error loading translations: %s", err.Error())
}
}
fyneApp := app.New()