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:
@@ -6,7 +6,6 @@ import (
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/storage"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"image/color"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
@@ -37,33 +36,25 @@ func (v View) SelectFFPath(
|
||||
form := &widget.Form{
|
||||
Items: []*widget.FormItem{
|
||||
{
|
||||
Text: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "titleDownloadLink",
|
||||
}),
|
||||
Text: v.app.GetLocalizerService().GetMessage("titleDownloadLink"),
|
||||
Widget: link,
|
||||
},
|
||||
{
|
||||
Text: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "pathToFfmpeg",
|
||||
}),
|
||||
Text: v.app.GetLocalizerService().GetMessage("pathToFfmpeg"),
|
||||
Widget: buttonFFmpeg,
|
||||
},
|
||||
{
|
||||
Widget: container.NewHScroll(buttonFFmpegMessage),
|
||||
},
|
||||
{
|
||||
Text: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "pathToFfprobe",
|
||||
}),
|
||||
Text: v.app.GetLocalizerService().GetMessage("pathToFfprobe"),
|
||||
Widget: buttonFFprobe,
|
||||
},
|
||||
{
|
||||
Widget: container.NewHScroll(buttonFFprobeMessage),
|
||||
},
|
||||
{
|
||||
Text: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "pathToFfplay",
|
||||
}),
|
||||
Text: v.app.GetLocalizerService().GetMessage("pathToFfplay"),
|
||||
Widget: buttonFFplay,
|
||||
},
|
||||
{
|
||||
@@ -73,9 +64,7 @@ func (v View) SelectFFPath(
|
||||
Widget: errorMessage,
|
||||
},
|
||||
},
|
||||
SubmitText: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "save",
|
||||
}),
|
||||
SubmitText: v.app.GetLocalizerService().GetMessage("save"),
|
||||
OnSubmit: func() {
|
||||
err := save(*ffmpegPath, *ffprobePath, *ffplayPath)
|
||||
if err != nil {
|
||||
@@ -85,13 +74,9 @@ func (v View) SelectFFPath(
|
||||
}
|
||||
if cancel != nil {
|
||||
form.OnCancel = cancel
|
||||
form.CancelText = v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "cancel",
|
||||
})
|
||||
form.CancelText = v.app.GetLocalizerService().GetMessage("cancel")
|
||||
}
|
||||
selectFFPathTitle := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "selectFFPathTitle",
|
||||
})
|
||||
selectFFPathTitle := v.app.GetLocalizerService().GetMessage("selectFFPathTitle")
|
||||
|
||||
if v.downloadFFmpeg.blockDownloadFFmpegContainer == nil {
|
||||
v.downloadFFmpeg.blockDownloadFFmpegContainer = v.blockDownloadFFmpeg(donwloadFFmpeg)
|
||||
@@ -110,9 +95,7 @@ func (v View) getButtonSelectFile(path string) (filePath *string, button *widget
|
||||
buttonMessage.TextSize = 16
|
||||
buttonMessage.TextStyle = fyne.TextStyle{Bold: true}
|
||||
|
||||
buttonTitle := v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "choose",
|
||||
})
|
||||
buttonTitle := v.app.GetLocalizerService().GetMessage("choose")
|
||||
|
||||
var locationURI fyne.ListableURI
|
||||
if len(path) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user