From 1814e2a6a3999e09c1b87b46710bd7af0dbc3e08 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Tue, 23 Jul 2024 08:53:06 -0700 Subject: [PATCH] add some missed translation strings --- res/translations/en.json | 19 ++++++++++++++++++- ui/mainwindow.go | 36 ++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/res/translations/en.json b/res/translations/en.json index 01a4cf5..5693b4b 100644 --- a/res/translations/en.json +++ b/res/translations/en.json @@ -1,4 +1,6 @@ { + "A new version is available": "A new version is available", + "About": "About", "Add Server": "Add Server", "Add to playlist": "Add to playlist", "Add to queue": "Add to queue", @@ -30,6 +32,7 @@ "BPM": "BPM", "Broadcast": "Broadcast", "Cancel": "Cancel", + "Check for Updates": "Check for Updates", "Close": "Close", "Close to system tray": "Close to system tray", "Comment": "Comment", @@ -76,6 +79,8 @@ "Genre": "Genre", "Genres": "Genres", "Github page": "Github page", + "Go to release page": "Go to release page", + "Hide": "Hide", "Home Page": "Home Page", "hr": "hr", "hrs": "hrs", @@ -86,6 +91,7 @@ "Last played": "Last played", "Live": "Live", "Locally": "Locally", + "Log Out": "Log Out", "Login to Server": "Login to Server", "Lyrics": "Lyrics", "Lyrics not available": "Lyrics not available", @@ -95,7 +101,9 @@ "My Server": "My Server", "Name": "Name", "Name (A-Z)": "Name (A-Z)", + "Next": "Next", "Nickname": "Nickname", + "No new version found": "No new version found", "No radio stations available": "No radio stations available", "None": "None", "none": "none", @@ -104,6 +112,7 @@ "optional": "optional", "or when": "or when", "Password": "Password", + "Pause": "Pause", "Paused": "Paused", "Peak Meter": "Peak Meter", "percent of track is played": "percent of track is played", @@ -121,6 +130,7 @@ "playlist by": "playlist by", "Plays": "Plays", "Prevent clipping": "Prevent clipping", + "Previous": "Previous", "Private": "Private", "Public": "Public", "Random": "Random", @@ -147,8 +157,10 @@ "Server Type": "Server Type", "Server unreachable": "Server unreachable", "Set rating": "Set rating", + "Settings": "Settings", "Share": "Share", "Share content": "Share content", + "Show": "Show", "Show info": "Show info", "Show notification on track change": "Show notification on track change", "Show year in album grid cards": "Show year in album grid cards", @@ -158,11 +170,13 @@ "Similar artists": "Similar artists", "Single": "Single", "Skip duplicate tracks": "Skip duplicate tracks", + "Skip this version": "Skip this version", "Soundtrack": "Soundtrack", "Spoken Word": "Spoken Word", "Startup page": "Startup page", "Stopped": "Stopped", "Support the project": "Support the project", + "Switch Servers": "Switch Servers", "Testing connection": "Testing connection", "Theme": "Theme", "Title": "Title", @@ -182,10 +196,13 @@ "Use legacy authentication": "Use legacy authentication", "Username": "Username", "version": "version", + "Visualizations": "Visualizations", + "Volume": "Volume", "wrong URL": "wrong URL", "wrong username/password": "wrong username/password", "Year": "Year", "Year (ascending)": "Year (ascending)", "Year (descending)": "Year (descending)", - "Year from": "Year from" + "Year from": "Year from", + "You are running the latest version of": "You are running the latest version of" } diff --git a/ui/mainwindow.go b/ui/mainwindow.go index c81ee8d..7c2aad2 100644 --- a/ui/mainwindow.go +++ b/ui/mainwindow.go @@ -134,27 +134,27 @@ func NewMainWindow(fyneApp fyne.App, appName, displayAppName, appVersion string, m.BrowsingPane.ClearHistory() m.Controller.PromptForLoginAndConnect() }) - m.BrowsingPane.AddSettingsMenuItem("Log Out", func() { app.ServerManager.Logout(true) }) - m.BrowsingPane.AddSettingsMenuItem("Switch Servers", func() { app.ServerManager.Logout(false) }) - m.BrowsingPane.AddSettingsMenuItem("Rescan Library", func() { app.ServerManager.Server.RescanLibrary() }) + m.BrowsingPane.AddSettingsMenuItem(lang.L("Log Out"), func() { app.ServerManager.Logout(true) }) + m.BrowsingPane.AddSettingsMenuItem(lang.L("Switch Servers"), func() { app.ServerManager.Logout(false) }) + m.BrowsingPane.AddSettingsMenuItem(lang.L("Rescan Library"), func() { app.ServerManager.Server.RescanLibrary() }) m.BrowsingPane.AddSettingsMenuSeparator() m.BrowsingPane.AddSettingsSubmenu(lang.L("Visualizations"), fyne.NewMenu("", []*fyne.MenuItem{ fyne.NewMenuItem(lang.L("Peak Meter"), m.Controller.ShowPeakMeter), }...)) - m.BrowsingPane.AddSettingsMenuItem("Check for Updates", func() { + m.BrowsingPane.AddSettingsMenuItem(lang.L("Check for Updates"), func() { go func() { if t := app.UpdateChecker.CheckLatestVersionTag(); t != "" && t != app.VersionTag() { m.ShowNewVersionDialog(displayAppName, t) } else { - dialog.ShowInformation("No new version found", - "You are running the latest version of "+displayAppName, + dialog.ShowInformation(lang.L("No new version found"), + lang.L("You are running the latest version of")+" "+displayAppName, m.Window) } }() }) - m.BrowsingPane.AddSettingsMenuItem("Settings...", m.showSettingsDialog) - m.BrowsingPane.AddSettingsMenuItem("About...", m.Controller.ShowAboutDialog) + m.BrowsingPane.AddSettingsMenuItem(lang.L("Settings")+"...", m.showSettingsDialog) + m.BrowsingPane.AddSettingsMenuItem(lang.L("About")+"...", m.Controller.ShowAboutDialog) m.addNavigationButtons() m.BrowsingPane.DisableNavigationButtons() m.addShortcuts() @@ -250,30 +250,30 @@ func (m *MainWindow) RunOnServerConnectedTasks(app *backend.App, displayAppName func (m *MainWindow) SetupSystemTrayMenu(appName string, fyneApp fyne.App) { if desk, ok := fyneApp.(desktop.App); ok { menu := fyne.NewMenu(appName, - fyne.NewMenuItem("Play/Pause", func() { + fyne.NewMenuItem(fmt.Sprintf("%s/%s", lang.L("Play"), lang.L("Pause")), func() { _ = m.App.PlaybackManager.PlayPause() }), - fyne.NewMenuItem("Previous", func() { + fyne.NewMenuItem(lang.L("Previous"), func() { _ = m.App.PlaybackManager.SeekBackOrPrevious() }), - fyne.NewMenuItem("Next", func() { + fyne.NewMenuItem(lang.L("Next"), func() { _ = m.App.PlaybackManager.SeekNext() }), fyne.NewMenuItemSeparator(), - fyne.NewMenuItem("Volume +10%", func() { + fyne.NewMenuItem(lang.L("Volume")+" +10%", func() { vol := m.App.PlaybackManager.Volume() vol = vol + int(float64(vol)*0.1) // will clamp to range for us m.App.PlaybackManager.SetVolume(vol) }), - fyne.NewMenuItem("Volume -10%", func() { + fyne.NewMenuItem(lang.L("Volume")+" -10%", func() { vol := m.App.PlaybackManager.Volume() vol = vol - int(float64(vol)*0.1) m.App.PlaybackManager.SetVolume(vol) }), fyne.NewMenuItemSeparator(), - fyne.NewMenuItem("Show", m.Window.Show), - fyne.NewMenuItem("Hide", m.Window.Hide), + fyne.NewMenuItem(lang.L("Show"), m.Window.Show), + fyne.NewMenuItem(lang.L("Hide"), m.Window.Hide), ) desk.SetSystemTrayMenu(menu) desk.SetSystemTrayIcon(res.ResAppicon256Png) @@ -289,8 +289,8 @@ func (m *MainWindow) ShowNewVersionDialog(appName, versionTag string) { contentStr := fmt.Sprintf("A new version of %s (%s) is available", appName, versionTag) m.Controller.QueueShowModalFunc(func() { - dialog.ShowCustomConfirm("A new version is available", - "Go to release page", "Skip this version", + dialog.ShowCustomConfirm(lang.L("A new version is available"), + lang.L("Go to release page"), lang.L("Skip this version"), widget.NewLabel(contentStr), func(show bool) { if show { fyne.CurrentApp().OpenURL(m.App.UpdateChecker.LatestReleaseURL()) @@ -301,7 +301,7 @@ func (m *MainWindow) ShowNewVersionDialog(appName, versionTag string) { } func (m *MainWindow) ShowWhatsNewDialog() { - dialog.ShowCustom("What's new in "+res.AppVersion, "Close", dialogs.NewWhatsNewDialog(), m.Window) + dialog.ShowCustom("What's new in "+res.AppVersion, lang.L("Close"), dialogs.NewWhatsNewDialog(), m.Window) } func (m *MainWindow) addNavigationButtons() {