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/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
)
|
||||
|
||||
type ItemsToConvertContract interface {
|
||||
@@ -35,21 +34,23 @@ func NewItemsToConvert(itemsContainer *fyne.Container, ffplayService FFplayContr
|
||||
|
||||
line := canvas.NewLine(theme.Color(theme.ColorNameFocus))
|
||||
line.StrokeWidth = 5
|
||||
checkboxAutoRemove := widget.NewCheck(localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "autoClearAfterAddingToQueue",
|
||||
}), func(checked bool) {
|
||||
ItemsToConvert.isAutoRemove = checked
|
||||
})
|
||||
checkboxAutoRemove := widget.NewCheck(
|
||||
localizerService.GetMessage("autoClearAfterAddingToQueue"),
|
||||
func(checked bool) {
|
||||
ItemsToConvert.isAutoRemove = checked
|
||||
},
|
||||
)
|
||||
checkboxAutoRemove.SetChecked(ItemsToConvert.isAutoRemove)
|
||||
localizerService.AddChangeCallback("autoClearAfterAddingToQueue", func(text string) {
|
||||
checkboxAutoRemove.Text = text
|
||||
})
|
||||
|
||||
buttonClear := widget.NewButton(localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "clearAll",
|
||||
}), func() {
|
||||
ItemsToConvert.clear()
|
||||
})
|
||||
buttonClear := widget.NewButton(
|
||||
localizerService.GetMessage("clearAll"),
|
||||
func() {
|
||||
ItemsToConvert.clear()
|
||||
},
|
||||
)
|
||||
buttonClear.Importance = widget.DangerImportance
|
||||
localizerService.AddChangeCallback("clearAll", func(text string) {
|
||||
buttonClear.Text = text
|
||||
|
||||
Reference in New Issue
Block a user