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:
@@ -8,7 +8,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"
|
||||
"io"
|
||||
"regexp"
|
||||
@@ -209,9 +208,7 @@ func (p Progress) Run(stdOut io.ReadCloser, stdErr io.ReadCloser) error {
|
||||
|
||||
if isProcessCompleted == false {
|
||||
if len(errorText) == 0 {
|
||||
errorText = p.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorConverter",
|
||||
})
|
||||
errorText = p.localizerService.GetMessage("errorConverter")
|
||||
}
|
||||
return errors.New(errorText)
|
||||
}
|
||||
@@ -227,15 +224,9 @@ type BlockProgressbarStatusesText struct {
|
||||
|
||||
func GetBlockProgressbarStatusesText(localizerService LocalizerContract) *BlockProgressbarStatusesText {
|
||||
statusesText := &BlockProgressbarStatusesText{
|
||||
inProgress: localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "inProgressQueue",
|
||||
}),
|
||||
completed: localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "completedQueue",
|
||||
}),
|
||||
error: localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorQueue",
|
||||
}),
|
||||
inProgress: localizerService.GetMessage("inProgressQueue"),
|
||||
completed: localizerService.GetMessage("completedQueue"),
|
||||
error: localizerService.GetMessage("errorQueue"),
|
||||
}
|
||||
|
||||
localizerService.AddChangeCallback("inProgressQueue", func(text string) {
|
||||
|
||||
Reference in New Issue
Block a user