add more translation entries

This commit is contained in:
Drew Weymouth
2024-07-21 11:12:55 -07:00
parent 0d2bca0a84
commit 1096e4434b
4 changed files with 70 additions and 42 deletions
+3 -3
View File
@@ -32,12 +32,12 @@ func NewSelectPlaylistDialog(mp mediaprovider.MediaProvider, im util.ImageFetche
}
sd := NewSearchDialog(
im,
"Add to playlist",
"Cancel",
lang.L("Add to playlist"),
lang.L("Cancel"),
sp.onSearched,
)
sd.ActionItem = widget.NewCheckWithData(lang.L("Skip duplicate tracks"), binding.BindBool(&sp.SkipDuplicates))
sd.PlaceholderText = "Search playlists or new playlist name"
sd.PlaceholderText = lang.L("Search playlists or new playlist name")
sp.SearchDialog = sd
return sp
}
+14 -13
View File
@@ -19,6 +19,7 @@ import (
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/data/binding"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/lang"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/storage"
"fyne.io/fyne/v2/theme"
@@ -138,12 +139,12 @@ func (s *SettingsDialog) createGeneralTab(canSaveQueueToServer bool) *container.
if startupPage.Selected == "" {
startupPage.SetSelectedIndex(0)
}
closeToTray := widget.NewCheckWithData("Close to system tray",
closeToTray := widget.NewCheckWithData(lang.L("Close to system tray"),
binding.BindBool(&s.config.Application.CloseToSystemTray))
if !s.config.Application.EnableSystemTray {
closeToTray.Disable()
}
systemTrayEnable := widget.NewCheck("Enable system tray", func(val bool) {
systemTrayEnable := widget.NewCheck(lang.L("Enable system tray"), func(val bool) {
s.config.Application.EnableSystemTray = val
// TODO: see https://github.com/fyne-io/fyne/issues/3788
// Once Fyne supports removing/hiding an existing system tray menu,
@@ -170,7 +171,7 @@ func (s *SettingsDialog) createGeneralTab(canSaveQueueToServer bool) *container.
if s.config.Application.SaveQueueToServer {
saveToServer.Selected = "To server"
}
saveQueue := widget.NewCheck("Save play queue on exit", func(save bool) {
saveQueue := widget.NewCheck(lang.L("Save play queue on exit"), func(save bool) {
s.config.Application.SavePlayQueue = save
if save && canSaveQueueToServer {
saveToServer.Enable()
@@ -184,9 +185,9 @@ func (s *SettingsDialog) createGeneralTab(canSaveQueueToServer bool) *container.
saveQueueHBox.Add(saveToServer)
}
trackNotif := widget.NewCheckWithData("Show notification on track change",
trackNotif := widget.NewCheckWithData(lang.L("Show notification on track change"),
binding.BindBool(&s.config.Application.ShowTrackChangeNotification))
albumGridYears := widget.NewCheck("Show year in album grid cards", func(b bool) {
albumGridYears := widget.NewCheck(lang.L("Show year in album grid cards"), func(b bool) {
s.config.AlbumsPage.ShowYears = b
s.config.FavoritesPage.ShowAlbumYears = b
if s.OnPageNeedsRefresh != nil {
@@ -256,7 +257,7 @@ func (s *SettingsDialog) createGeneralTab(canSaveQueueToServer bool) *container.
durationEnabled.Disable()
}
scrobbleEnabled := widget.NewCheck("Send playback statistics to server", func(checked bool) {
scrobbleEnabled := widget.NewCheck(lang.L("Send playback statistics to server"), func(checked bool) {
s.config.Scrobbling.Enabled = checked
if !checked {
percentEntry.Disable()
@@ -274,13 +275,13 @@ func (s *SettingsDialog) createGeneralTab(canSaveQueueToServer bool) *container.
})
scrobbleEnabled.Checked = s.config.Scrobbling.Enabled
return container.NewTabItem("General", container.NewVBox(
container.NewBorder(nil, nil, widget.NewLabel("Theme"), /*left*/
return container.NewTabItem(lang.L("General"), container.NewVBox(
container.NewBorder(nil, nil, widget.NewLabel(lang.L("Theme")), /*left*/
container.NewHBox(widget.NewLabel("Mode"), themeModeSelect, util.NewHSpace(5)), // right
themeFileSelect, // center
),
container.NewHBox(
widget.NewLabel("Startup page"), container.NewGridWithColumns(2, startupPage),
widget.NewLabel(lang.L("Startup page")), container.NewGridWithColumns(2, startupPage),
),
container.NewHBox(systemTrayEnable, closeToTray),
saveQueueHBox,
@@ -304,7 +305,7 @@ func (s *SettingsDialog) createGeneralTab(canSaveQueueToServer bool) *container.
}
func (s *SettingsDialog) createPlaybackTab(isLocalPlayer, isReplayGainPlayer bool) *container.TabItem {
disableTranscode := widget.NewCheckWithData("Disable server transcoding", binding.BindBool(&s.config.Transcoding.ForceRawFile))
disableTranscode := widget.NewCheckWithData(lang.L("Disable server transcoding"), binding.BindBool(&s.config.Transcoding.ForceRawFile))
deviceList := make([]string, len(s.audioDevices))
var selIndex int
for i, dev := range s.audioDevices {
@@ -411,7 +412,7 @@ func (s *SettingsDialog) createPlaybackTab(isLocalPlayer, isReplayGainPlayer boo
}
func (s *SettingsDialog) createEqualizerTab(eqBands []string) *container.TabItem {
enabled := widget.NewCheck("Enabled", func(b bool) {
enabled := widget.NewCheck(lang.L("Enabled"), func(b bool) {
s.config.LocalPlayback.EqualizerEnabled = b
if s.OnEqualizerSettingsChanged != nil {
s.OnEqualizerSettingsChanged()
@@ -435,7 +436,7 @@ func (s *SettingsDialog) createEqualizerTab(eqBands []string) *container.TabItem
debouncer()
}
cont := container.NewBorder(enabled, nil, nil, nil, geq)
return container.NewTabItem("Equalizer", cont)
return container.NewTabItem(lang.L("Equalizer"), cont)
}
func (s *SettingsDialog) createExperimentalTab(window fyne.Window) *container.TabItem {
@@ -524,7 +525,7 @@ func (s *SettingsDialog) setRestartRequired() {
if ts.Text != "" {
return
}
ts.Text = "Restart required"
ts.Text = lang.L("Restart required")
ts.Style.ColorName = theme.ColorNameError
s.promptText.Refresh()
}
+23 -22
View File
@@ -7,6 +7,7 @@ import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/lang"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
@@ -36,7 +37,7 @@ func NewTrackInfoDialog(track *mediaprovider.Track) *TrackInfoDialog {
func (t *TrackInfoDialog) CreateRenderer() fyne.WidgetRenderer {
c := container.New(layout.NewFormLayout())
addFormRow(c, "Title", t.track.Title)
addFormRow(c, lang.L("Title"), t.track.Title)
c.Add(newFormText("Album", true))
album := widget.NewHyperlink(t.track.Album, nil)
@@ -47,7 +48,7 @@ func (t *TrackInfoDialog) CreateRenderer() fyne.WidgetRenderer {
}
c.Add(album)
c.Add(newFormText("Artists", true))
c.Add(newFormText(lang.L("Artists"), true))
artists := widgets.NewMultiHyperlink()
artists.BuildSegments(t.track.ArtistNames, t.track.ArtistIDs)
artists.OnTapped = func(id string) {
@@ -58,7 +59,7 @@ func (t *TrackInfoDialog) CreateRenderer() fyne.WidgetRenderer {
c.Add(artists)
if len(t.track.ComposerNames) > 0 {
c.Add(newFormText("Composers", true))
c.Add(newFormText(lang.L("Composers"), true))
composers := widgets.NewMultiHyperlink()
composers.BuildSegments(t.track.ComposerNames, t.track.ComposerIDs)
artists.OnTapped = func(id string) {
@@ -70,7 +71,7 @@ func (t *TrackInfoDialog) CreateRenderer() fyne.WidgetRenderer {
}
if len(t.track.Genres) > 0 {
c.Add(newFormText("Genres", true))
c.Add(newFormText(lang.L("Genres"), true))
genres := widgets.NewMultiHyperlink()
genres.BuildSegments(t.track.Genres, t.track.Genres)
genres.OnTapped = func(g string) {
@@ -81,7 +82,7 @@ func (t *TrackInfoDialog) CreateRenderer() fyne.WidgetRenderer {
c.Add(genres)
}
addFormRow(c, "Duration", util.SecondsToTimeString(float64(t.track.Duration)))
addFormRow(c, lang.L("Duration"), util.SecondsToTimeString(float64(t.track.Duration)))
copyBtn := widgets.NewIconButton(theme.ContentCopyIcon(), func() {
if t.OnCopyFilePath != nil {
@@ -91,39 +92,39 @@ func (t *TrackInfoDialog) CreateRenderer() fyne.WidgetRenderer {
copyBtn.IconSize = widgets.IconButtonSizeSmaller
btnCtr := container.New(layout.NewCustomPaddedLayout(8, 0, 10, 0),
container.NewVBox(copyBtn, layout.NewSpacer()))
c.Add(container.NewHBox(btnCtr, newFormText("File path", true)))
c.Add(container.NewHBox(btnCtr, newFormText(lang.L("File path"), true)))
c.Add(newFormText(t.track.FilePath, false))
addFormRow(c, "Comment", t.track.Comment)
addFormRow(c, "Year", strconv.Itoa(t.track.Year))
addFormRow(c, "Track number", strconv.Itoa(t.track.TrackNumber))
addFormRow(c, "Disc number", strconv.Itoa(t.track.DiscNumber))
addFormRow(c, lang.L("Comment"), t.track.Comment)
addFormRow(c, lang.L("Year"), strconv.Itoa(t.track.Year))
addFormRow(c, lang.L("Track number"), strconv.Itoa(t.track.TrackNumber))
addFormRow(c, lang.L("Disc number"), strconv.Itoa(t.track.DiscNumber))
if t.track.BPM > 0 {
addFormRow(c, "BPM", strconv.Itoa(t.track.BPM))
addFormRow(c, lang.L("BPM"), strconv.Itoa(t.track.BPM))
}
addFormRow(c, "Content type", t.track.ContentType)
addFormRow(c, "Bit rate", fmt.Sprintf("%d kbps", t.track.BitRate))
addFormRow(c, "File size", util.BytesToSizeString(t.track.Size))
addFormRow(c, "Play count", strconv.Itoa(t.track.PlayCount))
addFormRow(c, lang.L("Content type"), t.track.ContentType)
addFormRow(c, lang.L("Bit rate"), fmt.Sprintf("%d kbps", t.track.BitRate))
addFormRow(c, lang.L("File size"), util.BytesToSizeString(t.track.Size))
addFormRow(c, lang.L("Play count"), strconv.Itoa(t.track.PlayCount))
if !t.track.LastPlayed.IsZero() {
addFormRow(c, "Last played", t.track.LastPlayed.Format(time.RFC1123))
addFormRow(c, lang.L("Last played"), t.track.LastPlayed.Format(time.RFC1123))
}
if t.track.ReplayGain.TrackPeak > 0 {
addFormRow(c, "Track gain", fmt.Sprintf("%0.2f dB", t.track.ReplayGain.TrackGain))
addFormRow(c, "Track peak", fmt.Sprintf("%0.6f", t.track.ReplayGain.TrackPeak))
addFormRow(c, lang.L("Track gain"), fmt.Sprintf("%0.2f dB", t.track.ReplayGain.TrackGain))
addFormRow(c, lang.L("Track peak"), fmt.Sprintf("%0.6f", t.track.ReplayGain.TrackPeak))
}
if t.track.ReplayGain.AlbumPeak > 0 {
addFormRow(c, "Album gain", fmt.Sprintf("%0.2f dB", t.track.ReplayGain.AlbumGain))
addFormRow(c, "Album peak", fmt.Sprintf("%0.6f", t.track.ReplayGain.AlbumPeak))
addFormRow(c, lang.L("Album gain"), fmt.Sprintf("%0.2f dB", t.track.ReplayGain.AlbumGain))
addFormRow(c, lang.L("Album peak"), fmt.Sprintf("%0.6f", t.track.ReplayGain.AlbumPeak))
}
title := widget.NewRichTextWithText("Track Info")
title := widget.NewRichTextWithText(lang.L("Track Info"))
title.Segments[0].(*widget.TextSegment).Style.TextStyle.Bold = true
dismissBtn := widget.NewButton("Close", func() {
dismissBtn := widget.NewButton(lang.L("Close"), func() {
if t.OnDismiss != nil {
t.OnDismiss()
}