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:
13
main.go
13
main.go
@@ -10,7 +10,6 @@ import (
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/menu"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/setting"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/theme"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
var application kernel.AppContract
|
||||
@@ -25,12 +24,6 @@ func init() {
|
||||
Icon: iconResource,
|
||||
}
|
||||
|
||||
localizerService, err := kernel.NewLocalizer("languages", language.Russian)
|
||||
if err != nil {
|
||||
kernel.PanicErrorLang(err, appMetadata)
|
||||
return
|
||||
}
|
||||
|
||||
ffPathUtilities = &kernel.FFPathUtilities{FFmpeg: "", FFprobe: "", FFplay: ""}
|
||||
convertorService := kernel.NewService(ffPathUtilities)
|
||||
ffplayService := kernel.NewFFplay(ffPathUtilities)
|
||||
@@ -38,7 +31,6 @@ func init() {
|
||||
queue := kernel.NewQueueList()
|
||||
application = kernel.NewApp(
|
||||
appMetadata,
|
||||
localizerService,
|
||||
queue,
|
||||
ffplayService,
|
||||
convertorService,
|
||||
@@ -71,12 +63,11 @@ func main() {
|
||||
themeRepository := theme.NewRepository(settingRepository)
|
||||
themeService := theme.NewTheme(application, themeRepository)
|
||||
|
||||
localizerRepository := localizer.NewRepository(settingRepository)
|
||||
menuView := menu.NewView(application)
|
||||
menuSettingView := menu.NewViewSetting(application, themeService)
|
||||
mainMenu := handler.NewMenuHandler(application, convertorHandler, menuView, menuSettingView, localizerView, localizerRepository, themeService)
|
||||
mainMenu := handler.NewMenuHandler(application, convertorHandler, menuView, menuSettingView, localizerView, themeService)
|
||||
|
||||
mainHandler := handler.NewMainHandler(application, convertorHandler, mainMenu, localizerRepository)
|
||||
mainHandler := handler.NewMainHandler(application, convertorHandler, mainMenu)
|
||||
mainHandler.Start()
|
||||
|
||||
application.GetWindow().SetMainMenu(mainMenu.GetMainMenu())
|
||||
|
Reference in New Issue
Block a user