Refactor localization system and migrate to Fyne's built-in support
Replaced the `i18n` and `toml` dependencies with Fyne's built-in language system for localization management. Updated the `Localizer` implementation to handle translations using JSON files and embed functionality. Simplified language selection and persisted settings via Fyne's preferences API.
This commit is contained in:
@@ -2,11 +2,9 @@ package error
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/localizer"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
)
|
||||
|
||||
type ViewContract interface {
|
||||
@@ -14,26 +12,17 @@ type ViewContract interface {
|
||||
}
|
||||
|
||||
type View struct {
|
||||
app kernel.AppContract
|
||||
isSetLanguage bool
|
||||
app kernel.AppContract
|
||||
}
|
||||
|
||||
func NewView(app kernel.AppContract) *View {
|
||||
return &View{
|
||||
app: app,
|
||||
isSetLanguage: true,
|
||||
app: app,
|
||||
}
|
||||
}
|
||||
|
||||
func (v View) PanicError(err error) {
|
||||
if v.isSetLanguage {
|
||||
v.isSetLanguage = false
|
||||
_ = v.app.GetLocalizerService().SetCurrentLanguageByCode(lang.SystemLocale().LanguageString())
|
||||
}
|
||||
|
||||
messageHead := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "error",
|
||||
})
|
||||
messageHead := v.app.GetLocalizerService().GetMessage("error")
|
||||
|
||||
v.app.GetWindow().SetContent(container.NewBorder(
|
||||
container.NewVBox(
|
||||
|
Reference in New Issue
Block a user