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.
76 lines
1.8 KiB
Go
76 lines
1.8 KiB
Go
package kernel
|
|
|
|
import (
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/container"
|
|
)
|
|
|
|
type RightTabsContract interface {
|
|
GetTabs() *container.AppTabs
|
|
GetAddedFilesContainer() *fyne.Container
|
|
GetFileQueueContainer() *fyne.Container
|
|
SelectFileQueueTab()
|
|
SelectAddedFilesTab()
|
|
}
|
|
|
|
type RightTabs struct {
|
|
tabs *container.AppTabs
|
|
|
|
addedFilesContainer *fyne.Container
|
|
addedFilesTab *container.TabItem
|
|
|
|
fileQueueContainer *fyne.Container
|
|
fileQueueTab *container.TabItem
|
|
}
|
|
|
|
func NewRightTabs(localizerService LocalizerContract) *RightTabs {
|
|
addedFilesContainer := container.NewVBox()
|
|
addedFilesTab := container.NewTabItem(localizerService.GetMessage("addedFilesTitle"), addedFilesContainer)
|
|
localizerService.AddChangeCallback("addedFilesTitle", func(text string) {
|
|
addedFilesTab.Text = text
|
|
})
|
|
|
|
fileQueueContainer := container.NewVBox()
|
|
fileQueueTab := container.NewTabItem(localizerService.GetMessage("fileQueueTitle"), fileQueueContainer)
|
|
localizerService.AddChangeCallback("fileQueueTitle", func(text string) {
|
|
fileQueueTab.Text = text
|
|
})
|
|
|
|
tabs := container.NewAppTabs(
|
|
addedFilesTab,
|
|
fileQueueTab,
|
|
)
|
|
|
|
return &RightTabs{
|
|
tabs: tabs,
|
|
addedFilesContainer: addedFilesContainer,
|
|
addedFilesTab: addedFilesTab,
|
|
fileQueueContainer: fileQueueContainer,
|
|
fileQueueTab: fileQueueTab,
|
|
}
|
|
}
|
|
|
|
func (t RightTabs) GetTabs() *container.AppTabs {
|
|
return t.tabs
|
|
}
|
|
|
|
func (t RightTabs) GetAddedFilesContainer() *fyne.Container {
|
|
return t.addedFilesContainer
|
|
}
|
|
|
|
func (t RightTabs) GetFileQueueContainer() *fyne.Container {
|
|
return t.fileQueueContainer
|
|
}
|
|
|
|
func (t RightTabs) SelectFileQueueTab() {
|
|
fyne.Do(func() {
|
|
t.tabs.Select(t.fileQueueTab)
|
|
})
|
|
}
|
|
|
|
func (t RightTabs) SelectAddedFilesTab() {
|
|
fyne.Do(func() {
|
|
t.tabs.Select(t.addedFilesTab)
|
|
})
|
|
}
|