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"
|
||||
"image/color"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -77,7 +76,7 @@ type QueueLayoutItem struct {
|
||||
}
|
||||
|
||||
func NewQueueLayoutObject(queue QueueListContract, localizerService LocalizerContract, ffplayService FFplayContract, rightTabsService RightTabsContract, blockProgressbar *fyne.Container) *QueueLayoutObject {
|
||||
title := widget.NewLabel(localizerService.GetMessage(&i18n.LocalizeConfig{MessageID: "queue"}))
|
||||
title := widget.NewLabel(localizerService.GetMessage("queue"))
|
||||
title.TextStyle.Bold = true
|
||||
|
||||
localizerService.AddChangeCallback("queue", func(text string) {
|
||||
@@ -222,7 +221,7 @@ func (o QueueLayoutObject) getStatusColor(status StatusContract) color.Color {
|
||||
}
|
||||
|
||||
func (o QueueLayoutObject) getStatusTitle(status StatusContract) string {
|
||||
return o.localizerService.GetMessage(&i18n.LocalizeConfig{MessageID: status.Name() + "Queue"})
|
||||
return o.localizerService.GetMessage(status.Name() + "Queue")
|
||||
}
|
||||
|
||||
type queueStatistics struct {
|
||||
@@ -441,7 +440,7 @@ func newQueueStatistics(messaigeID string, localizerService LocalizerContract) *
|
||||
|
||||
count := int64(0)
|
||||
|
||||
title := localizerService.GetMessage(&i18n.LocalizeConfig{MessageID: messaigeID})
|
||||
title := localizerService.GetMessage(messaigeID)
|
||||
queueStatistics := &queueStatistics{
|
||||
widget: checkbox,
|
||||
title: strings.ToLower(title),
|
||||
|
||||
Reference in New Issue
Block a user