From 48db088af77f320ab75787ecd0410051f66b33b3 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Sat, 20 Jul 2024 09:22:30 -0700 Subject: [PATCH] more translation prep --- res/translations/en.json | 38 ++++++++++++++++++++++++++++++++++- ui/browsing/albumpage.go | 17 ++++++++-------- ui/browsing/artistpage.go | 20 +++++++++++------- ui/browsing/artistspage.go | 3 ++- ui/browsing/favoritespage.go | 5 +++-- ui/browsing/genrespage.go | 18 +++++++++++------ ui/browsing/nowplayingpage.go | 7 ++++--- ui/browsing/playlistpage.go | 30 +++++++++++++++------------ ui/browsing/playlistspage.go | 11 ++++++---- ui/browsing/radiospage.go | 15 +++++++------- ui/browsing/trackspage.go | 7 ++++--- 11 files changed, 116 insertions(+), 55 deletions(-) diff --git a/res/translations/en.json b/res/translations/en.json index 475eb53..cfa702a 100644 --- a/res/translations/en.json +++ b/res/translations/en.json @@ -1,13 +1,49 @@ { + "Add to playlist": "Add to playlist", + "Add to queue": "Add to queue", "Album": "Album", + "Album count": "Album count", "Album gain": "Album gain", "Album peak": "Album peak", + "All Tracks": "All Tracks", "Artist": "Artist", + "Artists": "Artists", + "Artist biography not available.": "Artist biography not available.", + "Configure your music server to add radio stations": "Configure your music server to add radio stations", + "Discography": "Discography", + "Download": "Download", "Duration": "Duration", + "Edit": "Edit", + "Favorites": "Favorites", + "Genre": "Genre", + "Genres": "Genres", + "Internet Radio Stations": "Internet Radio Stations", + "Lyrics": "Lyrics", + "Name": "Name", + "No radio stations available": "No radio stations available", + "Play": "Play", + "Playlist": "Playlist", + "Playlists": "Playlists", + "playlist by": "playlist by", + "Play next": "Play next", + "Play Queue": "Play Queue", + "Play random": "Play random", + "Private": "Private", + "Public": "Public", + "Related": "Related", + "Remove from playlist": "Remove from playlist", + "Search page": "Search page", + "Share": "Share", + "Show info": "Show info", + "Shuffle": "Shuffle", + "Similar artists": "Similar artists", "Title": "Title", + "Top Tracks": "Top Tracks", "Track": "Track", + "track": "track", + "tracks": "tracks", + "Track count": "Track count", "Track gain": "Track gain", "Track peak": "Track peak", - "Genre": "Genre", "Year": "Year" } \ No newline at end of file diff --git a/ui/browsing/albumpage.go b/ui/browsing/albumpage.go index c2e6339..c243e26 100644 --- a/ui/browsing/albumpage.go +++ b/ui/browsing/albumpage.go @@ -15,6 +15,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" @@ -224,10 +225,10 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader { a.page.contr.NavigateTo(controller.GenreRoute(genre)) } a.miscLabel = widget.NewLabel("") - playButton := widget.NewButtonWithIcon("Play", theme.MediaPlayIcon(), func() { + playButton := widget.NewButtonWithIcon(lang.L("Play"), theme.MediaPlayIcon(), func() { go a.page.pm.PlayAlbum(a.page.albumID, 0, false) }) - shuffleBtn := widget.NewButtonWithIcon("Shuffle", myTheme.ShuffleIcon, func() { + shuffleBtn := widget.NewButtonWithIcon(lang.L("Shuffle"), myTheme.ShuffleIcon, func() { a.page.pm.LoadTracks(a.page.tracklist.GetTracks(), backend.Replace, true) a.page.pm.PlayFromBeginning() }) @@ -235,28 +236,28 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader { menuBtn := widget.NewButtonWithIcon("", theme.MoreHorizontalIcon(), nil) menuBtn.OnTapped = func() { if pop == nil { - playNext := fyne.NewMenuItem("Play next", func() { + playNext := fyne.NewMenuItem(lang.L("Play next"), func() { go a.page.pm.LoadAlbum(a.albumID, backend.InsertNext, false /*shuffle*/) }) playNext.Icon = myTheme.PlayNextIcon - queue := fyne.NewMenuItem("Add to queue", func() { + queue := fyne.NewMenuItem(lang.L("Add to queue"), func() { go a.page.pm.LoadAlbum(a.albumID, backend.Append, false /*shuffle*/) }) queue.Icon = theme.ContentAddIcon() - playlist := fyne.NewMenuItem("Add to playlist...", func() { + playlist := fyne.NewMenuItem(lang.L("Add to playlist")+"...", func() { a.page.contr.DoAddTracksToPlaylistWorkflow( sharedutil.TracksToIDs(a.page.tracks)) }) playlist.Icon = myTheme.PlaylistIcon - download := fyne.NewMenuItem("Download...", func() { + download := fyne.NewMenuItem(lang.L("Download")+"...", func() { a.page.contr.ShowDownloadDialog(a.page.tracks, a.titleLabel.String()) }) download.Icon = theme.DownloadIcon() - info := fyne.NewMenuItem("Show Info...", func() { + info := fyne.NewMenuItem(lang.L("Show info")+"...", func() { a.page.contr.ShowAlbumInfoDialog(a.albumID, a.titleLabel.String(), a.cover.Image()) }) info.Icon = theme.InfoIcon() - a.shareMenuItem = fyne.NewMenuItem("Share...", func() { + a.shareMenuItem = fyne.NewMenuItem(lang.L("Share")+"...", func() { a.page.contr.ShowShareDialog(a.albumID) }) a.shareMenuItem.Icon = myTheme.ShareIcon diff --git a/ui/browsing/artistpage.go b/ui/browsing/artistpage.go index eee6c55..d13ee17 100644 --- a/ui/browsing/artistpage.go +++ b/ui/browsing/artistpage.go @@ -15,6 +15,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" @@ -50,9 +51,14 @@ type ArtistPage struct { container *fyne.Container } +const ( + viewTopTracks = "Top Tracks" + viewDiscography = "Discography" +) + func NewArtistPage(artistID string, cfg *backend.ArtistPageConfig, pool *util.WidgetPool, pm *backend.PlaybackManager, mp mediaprovider.MediaProvider, im *backend.ImageManager, contr *controller.Controller) *ArtistPage { activeView := 0 - if cfg.InitialView == "Top Tracks" { + if cfg.InitialView == viewTopTracks { activeView = 1 } return newArtistPage(artistID, cfg, pool, pm, mp, im, contr, activeView, widgets.TracklistSort{}) @@ -81,7 +87,7 @@ func newArtistPage(artistID string, cfg *backend.ArtistPageConfig, pool *util.Wi if img, ok := im.GetCachedArtistImage(artistID); ok { a.header.artistImage.SetImage(img, true /*tappable*/) } - viewToggle := widgets.NewToggleText(0, []string{"Discography", "Top Tracks"}) + viewToggle := widgets.NewToggleText(0, []string{lang.L("Discography"), lang.L("Top Tracks")}) viewToggle.SetActivatedLabel(a.activeView) viewToggle.OnChanged = a.onViewChange //line := canvas.NewLine(theme.TextColor()) @@ -270,9 +276,9 @@ func (a *ArtistPage) onViewChange(num int) { } a.activeView = num if num == 1 { - a.cfg.InitialView = "Top Tracks" + a.cfg.InitialView = viewTopTracks } else { - a.cfg.InitialView = "Discography" + a.cfg.InitialView = viewDiscography } } @@ -285,7 +291,7 @@ func (s *artistPageState) Restore() Page { return newArtistPage(s.artistID, s.cfg, s.pool, s.pm, s.mp, s.im, s.contr, s.activeView, s.trackSort) } -const artistBioNotAvailableStr = "Artist biography not available." +const artistBioNotAvailableKey = "Artist biography not available." type ArtistPageHeader struct { widget.BaseWidget @@ -310,7 +316,7 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader { a := &ArtistPageHeader{ artistPage: page, titleDisp: widget.NewRichTextWithText(""), - biographyDisp: widgets.NewMaxRowsLabel(5, artistBioNotAvailableStr), + biographyDisp: widgets.NewMaxRowsLabel(5, lang.L(artistBioNotAvailableKey)), similarArtists: container.NewHBox(), } a.titleDisp.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{ @@ -374,7 +380,7 @@ func (a *ArtistPageHeader) Clear() { a.artistID = "" a.favoriteBtn.IsFavorited = false a.titleDisp.Segments[0].(*widget.TextSegment).Text = "" - a.biographyDisp.Text = artistBioNotAvailableStr + a.biographyDisp.Text = lang.L(artistBioNotAvailableKey) for _, obj := range a.similarArtists.Objects { obj.Hide() } diff --git a/ui/browsing/artistspage.go b/ui/browsing/artistspage.go index 6a713a2..23c0788 100644 --- a/ui/browsing/artistspage.go +++ b/ui/browsing/artistspage.go @@ -4,6 +4,7 @@ import ( "slices" "fyne.io/fyne/v2" + "fyne.io/fyne/v2/lang" "fyne.io/fyne/v2/widget" "github.com/dweymouth/supersonic/backend" "github.com/dweymouth/supersonic/backend/mediaprovider" @@ -26,7 +27,7 @@ func NewArtistsPage(cfg *backend.ArtistsPageConfig, pool *util.WidgetPool, contr return NewGridViewPage(adapter, pool, mp, im) } -func (a *artistsPageAdapter) Title() string { return "Artists" } +func (a *artistsPageAdapter) Title() string { return lang.L("Artists") } func (a *artistsPageAdapter) Filter() mediaprovider.ArtistFilter { if a.filter == nil { diff --git a/ui/browsing/favoritespage.go b/ui/browsing/favoritespage.go index bc1c172..3599cd2 100644 --- a/ui/browsing/favoritespage.go +++ b/ui/browsing/favoritespage.go @@ -14,6 +14,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" @@ -85,7 +86,7 @@ func NewFavoritesPage(cfg *backend.FavoritesPageConfig, pool *util.WidgetPool, c } func (a *FavoritesPage) createHeader(activeBtnIdx int) { - a.titleDisp = widget.NewRichTextWithText("Favorites") + a.titleDisp = widget.NewRichTextWithText(lang.L("Favorites")) a.titleDisp.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{ SizeName: theme.SizeNameHeadingText, } @@ -94,7 +95,7 @@ func (a *FavoritesPage) createHeader(activeBtnIdx int) { widget.NewButtonWithIcon("", myTheme.ArtistIcon, a.onShowFavoriteArtists), widget.NewButtonWithIcon("", myTheme.TracksIcon, a.onShowFavoriteSongs)) a.searcher = widgets.NewSearchEntry() - a.searcher.PlaceHolder = "Search page" + a.searcher.PlaceHolder = lang.L("Search page") a.searcher.OnSearched = a.OnSearched a.searcher.Entry.Text = a.searchText a.filterBtn = widgets.NewAlbumFilterButton(a.filter, a.mp.GetGenres) diff --git a/ui/browsing/genrespage.go b/ui/browsing/genrespage.go index 504d911..ea358a3 100644 --- a/ui/browsing/genrespage.go +++ b/ui/browsing/genrespage.go @@ -14,6 +14,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" @@ -42,14 +43,14 @@ func newGenresPage(contr *controller.Controller, mp mediaprovider.MediaProvider, a := &GenresPage{ contr: contr, mp: mp, - titleDisp: widget.NewRichTextWithText("Genres"), + titleDisp: widget.NewRichTextWithText(lang.L("Genres")), } a.ExtendBaseWidget(a) a.titleDisp.Segments[0].(*widget.TextSegment).Style.SizeName = theme.SizeNameHeadingText a.list = NewGenreList(sorting) a.list.OnNavTo = func(id string) { a.contr.NavigateTo(controller.GenreRoute(id)) } a.searcher = widgets.NewSearchEntry() - a.searcher.PlaceHolder = "Search page" + a.searcher.PlaceHolder = lang.L("Search page") a.searcher.OnSearched = a.onSearched a.searcher.Entry.Text = searchText a.buildContainer() @@ -188,15 +189,20 @@ func NewGenreListRow(layout *layouts.ColumnsLayout) *GenreListRow { } func NewGenreList(sorting widgets.ListHeaderSort) *GenreList { + albumCount := lang.L("Album count") + trackCount := lang.L("Track count") + albumW := widget.NewLabel(albumCount).MinSize().Width + 15 /*room for sort icon */ + trackW := widget.NewLabel(trackCount).MinSize().Width + 15 /*room for sort icon */ + a := &GenreList{ sorting: sorting, - columnsLayout: layouts.NewColumnsLayout([]float32{-1, 125, 125}), + columnsLayout: layouts.NewColumnsLayout([]float32{-1, albumW, trackW}), } a.ExtendBaseWidget(a) a.hdr = widgets.NewListHeader([]widgets.ListColumn{ - {Text: "Name", Alignment: fyne.TextAlignLeading, CanToggleVisible: false}, - {Text: "Album Count", Alignment: fyne.TextAlignTrailing, CanToggleVisible: false}, - {Text: "Track Count", Alignment: fyne.TextAlignTrailing, CanToggleVisible: false}}, + {Text: lang.L("Name"), Alignment: fyne.TextAlignLeading, CanToggleVisible: false}, + {Text: albumCount, Alignment: fyne.TextAlignTrailing, CanToggleVisible: false}, + {Text: trackCount, Alignment: fyne.TextAlignTrailing, CanToggleVisible: false}}, a.columnsLayout) a.hdr.SetSorting(sorting) a.hdr.OnColumnSortChanged = a.onSorted diff --git a/ui/browsing/nowplayingpage.go b/ui/browsing/nowplayingpage.go index 571ef50..576a6b9 100644 --- a/ui/browsing/nowplayingpage.go +++ b/ui/browsing/nowplayingpage.go @@ -27,6 +27,7 @@ import ( "fyne.io/fyne/v2" "fyne.io/fyne/v2/canvas" "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" @@ -203,12 +204,12 @@ func (a *NowPlayingPage) CreateRenderer() fyne.WidgetRenderer { a.lyricsLoading = widgets.NewLoadingDots() a.relatedLoading = widgets.NewLoadingDots() a.tabs = container.NewAppTabs( - container.NewTabItem("Play Queue", + container.NewTabItem(lang.L("Play Queue"), container.NewBorder(layout.NewSpacer(), nil, nil, nil, a.queueList)), - container.NewTabItem("Lyrics", container.NewStack( + container.NewTabItem(lang.L("Lyrics"), container.NewStack( a.lyricsViewer, container.NewCenter(a.lyricsLoading))), - container.NewTabItem("Related", container.NewStack( + container.NewTabItem(lang.L("Related"), container.NewStack( a.relatedList, container.NewCenter(a.relatedLoading))), ) diff --git a/ui/browsing/playlistpage.go b/ui/browsing/playlistpage.go index 58f7f13..8ed3ad9 100644 --- a/ui/browsing/playlistpage.go +++ b/ui/browsing/playlistpage.go @@ -14,6 +14,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" @@ -89,7 +90,7 @@ func newPlaylistPage( a.tracklist.OnReorderTracks = a.doSetNewTrackOrder _, canRate := a.sm.Server.(mediaprovider.SupportsRating) _, canShare := a.sm.Server.(mediaprovider.SupportsSharing) - remove := fyne.NewMenuItem("Remove from playlist", a.onRemoveSelectedFromPlaylist) + remove := fyne.NewMenuItem(lang.L("Remove from playlist"), a.onRemoveSelectedFromPlaylist) remove.Icon = theme.ContentClearIcon() a.tracklist.Options = widgets.TracklistOptions{ Reorderable: true, @@ -252,17 +253,17 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader { a.ownerLabel = util.NewTruncatingLabel() a.createdAtLabel = widget.NewLabel("") a.trackTimeLabel = widget.NewLabel("") - a.editButton = widget.NewButtonWithIcon("Edit", theme.DocumentCreateIcon(), func() { + a.editButton = widget.NewButtonWithIcon(lang.L("Edit"), theme.DocumentCreateIcon(), func() { if a.playlistInfo != nil { a.page.contr.DoEditPlaylistWorkflow(&a.playlistInfo.Playlist) } }) a.editButton.Hidden = true - playButton := widget.NewButtonWithIcon("Play", theme.MediaPlayIcon(), func() { + playButton := widget.NewButtonWithIcon(lang.L("Play"), theme.MediaPlayIcon(), func() { a.page.pm.LoadTracks(a.page.tracks, backend.Replace, false) a.page.pm.PlayFromBeginning() }) - shuffleBtn := widget.NewButtonWithIcon("Shuffle", myTheme.ShuffleIcon, func() { + shuffleBtn := widget.NewButtonWithIcon(lang.L("Shuffle"), myTheme.ShuffleIcon, func() { a.page.pm.LoadTracks(a.page.tracks, backend.Replace, true) a.page.pm.PlayFromBeginning() }) @@ -270,20 +271,20 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader { menuBtn := widget.NewButtonWithIcon("", theme.MoreHorizontalIcon(), nil) menuBtn.OnTapped = func() { if pop == nil { - playNext := fyne.NewMenuItem("Play next", func() { + playNext := fyne.NewMenuItem(lang.L("Play next"), func() { go a.page.pm.LoadPlaylist(a.page.playlistID, backend.InsertNext, false) }) playNext.Icon = myTheme.PlayNextIcon - queue := fyne.NewMenuItem("Add to queue", func() { + queue := fyne.NewMenuItem(lang.L("Add to queue"), func() { go a.page.pm.LoadPlaylist(a.page.playlistID, backend.Append, false) }) queue.Icon = theme.ContentAddIcon() - playlist := fyne.NewMenuItem("Add to playlist...", func() { + playlist := fyne.NewMenuItem(lang.L("Add to playlist")+"...", func() { a.page.contr.DoAddTracksToPlaylistWorkflow( sharedutil.TracksToIDs(a.page.tracks)) }) playlist.Icon = myTheme.PlaylistIcon - download := fyne.NewMenuItem("Download...", func() { + download := fyne.NewMenuItem(lang.L("Download")+"...", func() { a.page.contr.ShowDownloadDialog(a.page.tracks, a.titleLabel.String()) }) download.Icon = theme.DownloadIcon() @@ -342,17 +343,20 @@ func (a *PlaylistPageHeader) Update(playlist *mediaprovider.PlaylistWithTracks) } func (a *PlaylistPageHeader) formatPlaylistOwnerStr(p *mediaprovider.PlaylistWithTracks) string { - pubPriv := "Public" + pubPriv := lang.L("Public") if !p.Public { - pubPriv = "Private" + pubPriv = lang.L("Private") } - return fmt.Sprintf("%s playlist by %s", pubPriv, p.Owner) + playlistBy := lang.L("playlist by") + return fmt.Sprintf("%s %s %s", pubPriv, playlistBy, p.Owner) } func (a *PlaylistPageHeader) formatPlaylistTrackTimeStr(p *mediaprovider.PlaylistWithTracks) string { - tracks := "tracks" + var tracks string if p.TrackCount == 1 { - tracks = "track" + tracks = lang.L("track") + } else { + tracks = lang.L("tracks") } return fmt.Sprintf("%d %s, %s", p.TrackCount, tracks, util.SecondsToTimeString(float64(p.Duration))) } diff --git a/ui/browsing/playlistspage.go b/ui/browsing/playlistspage.go index 95c4ac1..b9c3565 100644 --- a/ui/browsing/playlistspage.go +++ b/ui/browsing/playlistspage.go @@ -19,6 +19,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" @@ -71,14 +72,14 @@ func newPlaylistsPage( mp: mp, contr: contr, listSort: listSort, - titleDisp: widget.NewRichTextWithText("Playlists"), + titleDisp: widget.NewRichTextWithText(lang.L("Playlists")), initialListScrollPos: listScrollPos, initialGridScrollPos: gridScrollPos, } a.ExtendBaseWidget(a) a.titleDisp.Segments[0].(*widget.TextSegment).Style.SizeName = theme.SizeNameHeadingText a.searcher = widgets.NewSearchEntry() - a.searcher.PlaceHolder = "Search page" + a.searcher.PlaceHolder = lang.L("Search page") a.searcher.OnSearched = a.onSearched a.searcher.Entry.Text = searchText a.viewToggle = widgets.NewToggleButtonGroup(0, @@ -193,9 +194,11 @@ func (a *PlaylistsPage) showGridView() { func createPlaylistGridViewModel(playlists []*mediaprovider.Playlist) []widgets.GridViewItemModel { return sharedutil.MapSlice(playlists, func(pl *mediaprovider.Playlist) widgets.GridViewItemModel { - tracks := "tracks" + var tracks string if pl.TrackCount == 1 { - tracks = "track" + tracks = lang.L("track") + } else { + tracks = lang.L("tracks") } return widgets.GridViewItemModel{ Name: pl.Name, diff --git a/ui/browsing/radiospage.go b/ui/browsing/radiospage.go index 1fd9acf..beaeba8 100644 --- a/ui/browsing/radiospage.go +++ b/ui/browsing/radiospage.go @@ -15,6 +15,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" @@ -48,7 +49,7 @@ func newRadiosPage(contr *controller.Controller, rp mediaprovider.RadioProvider, contr: contr, rp: rp, pm: pm, - titleDisp: widget.NewRichTextWithText("Internet Radio Stations"), + titleDisp: widget.NewRichTextWithText(lang.L("Internet Radio Stations")), } a.ExtendBaseWidget(a) a.titleDisp.Segments[0].(*widget.TextSegment).Style.SizeName = theme.SizeNameHeadingText @@ -56,13 +57,13 @@ func newRadiosPage(contr *controller.Controller, rp mediaprovider.RadioProvider, a.list.OnPlay = a.onPlay a.list.OnQueue = a.onQueue a.searcher = widgets.NewSearchEntry() - a.searcher.PlaceHolder = "Search page" + a.searcher.PlaceHolder = lang.L("Search page") a.searcher.OnSearched = a.onSearched a.searcher.Entry.Text = searchText a.noRadiosMsg = container.NewCenter(widgets.NewInfoMessage( - "No radio stations available", - "Configure your music server to add radio stations", + lang.L("No radio stations available"), + lang.L("Configure your music server to add radio stations"), )) a.noRadiosMsg.Hide() @@ -314,21 +315,21 @@ func NewRadioList(nowPlayingIDPtr *string) *RadioList { func (a *RadioList) showMenu(pos fyne.Position) { if a.menu == nil { - play := fyne.NewMenuItem("Play", func() { + play := fyne.NewMenuItem(lang.L("Play"), func() { if a.OnPlay != nil { a.OnPlay(a.selected.Item) } }) play.Icon = theme.MediaPlayIcon() - playNext := fyne.NewMenuItem("Play next", func() { + playNext := fyne.NewMenuItem(lang.L("Play next"), func() { if a.OnQueue != nil { a.OnQueue(a.selected.Item, true) } }) playNext.Icon = myTheme.PlayNextIcon - append := fyne.NewMenuItem("Add to queue", func() { + append := fyne.NewMenuItem(lang.L("Add to queue"), func() { if a.OnQueue != nil { a.OnQueue(a.selected.Item, false) } diff --git a/ui/browsing/trackspage.go b/ui/browsing/trackspage.go index 2b6b505..9e106bc 100644 --- a/ui/browsing/trackspage.go +++ b/ui/browsing/trackspage.go @@ -11,6 +11,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/widget" ) @@ -65,11 +66,11 @@ func NewTracksPage(contr *controller.Controller, conf *backend.TracksPageConfig, } contr.ConnectTracklistActions(t.tracklist) - t.title = widget.NewRichTextWithText("All Tracks") + t.title = widget.NewRichTextWithText(lang.L("All Tracks")) t.title.Segments[0].(*widget.TextSegment).Style.SizeName = widget.RichTextStyleHeading.SizeName - t.playRandom = widget.NewButtonWithIcon("Play random", theme.ShuffleIcon, t.playRandomSongs) + t.playRandom = widget.NewButtonWithIcon(lang.L("Play random"), theme.ShuffleIcon, t.playRandomSongs) t.searcher = widgets.NewSearchEntry() - t.searcher.PlaceHolder = "Search page" + t.searcher.PlaceHolder = lang.L("Search page") t.searcher.OnSearched = t.OnSearched t.createContainer() t.Reload()