and some more
This commit is contained in:
@@ -212,7 +212,7 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
|
||||
SizeName: theme.SizeNameHeadingText,
|
||||
}
|
||||
a.releaseTypeLabel = widget.NewRichText(
|
||||
&widget.TextSegment{Text: "Album", Style: util.BoldRichTextStyle},
|
||||
&widget.TextSegment{Text: lang.L("Album"), Style: util.BoldRichTextStyle},
|
||||
&widget.TextSegment{Text: " by", Style: widget.RichTextStyle{Inline: true}},
|
||||
)
|
||||
a.artistLabel = widgets.NewMultiHyperlink()
|
||||
@@ -361,16 +361,16 @@ func formatMiscLabelStr(a *mediaprovider.AlbumWithTracks) string {
|
||||
var discs string
|
||||
if len(a.Tracks) > 0 {
|
||||
if discCount := a.Tracks[len(a.Tracks)-1].DiscNumber; discCount > 1 {
|
||||
discs = fmt.Sprintf("%d discs · ", discCount)
|
||||
discs = fmt.Sprintf("%d %s · ", discCount, lang.L("discs"))
|
||||
}
|
||||
}
|
||||
tracks := "tracks"
|
||||
tracks := lang.L("tracks")
|
||||
if a.TrackCount == 1 {
|
||||
tracks = "track"
|
||||
tracks = lang.L("track")
|
||||
}
|
||||
yearStr := strconv.Itoa(a.Year)
|
||||
if a.ReissueYear > a.Year {
|
||||
yearStr += fmt.Sprintf(" (reissued %d)", a.ReissueYear)
|
||||
yearStr += fmt.Sprintf(" (%s %d)", lang.L("reissued"), a.ReissueYear)
|
||||
}
|
||||
return fmt.Sprintf("%s · %d %s · %s%s", yearStr, a.TrackCount, tracks, discs, util.SecondsToTimeString(float64(a.Duration)))
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
@@ -27,7 +28,7 @@ func NewAlbumsPage(cfg *backend.AlbumsPageConfig, pool *util.WidgetPool, contr *
|
||||
return NewGridViewPage(adapter, pool, mp, im)
|
||||
}
|
||||
|
||||
func (a *albumsPageAdapter) Title() string { return "Albums" }
|
||||
func (a *albumsPageAdapter) Title() string { return lang.L("Albums") }
|
||||
|
||||
func (a *albumsPageAdapter) Filter() mediaprovider.AlbumFilter {
|
||||
if a.filter == nil {
|
||||
|
||||
@@ -329,10 +329,10 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader {
|
||||
}
|
||||
}
|
||||
a.favoriteBtn = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
|
||||
a.playBtn = widget.NewButtonWithIcon("Play Discography", theme.MediaPlayIcon(), func() {
|
||||
a.playBtn = widget.NewButtonWithIcon(lang.L("Play Discography"), theme.MediaPlayIcon(), func() {
|
||||
go a.artistPage.pm.PlayArtistDiscography(a.artistID, false /*shuffle*/)
|
||||
})
|
||||
a.playRadioBtn = widget.NewButtonWithIcon("Play Artist Radio", myTheme.ShuffleIcon, func() {
|
||||
a.playRadioBtn = widget.NewButtonWithIcon(lang.L("Play Artist Radio"), myTheme.ShuffleIcon, func() {
|
||||
// must not pass playArtistRadio func directly to NewButton
|
||||
// because the artistPage bound to this header can change when reused
|
||||
a.artistPage.playArtistRadio()
|
||||
@@ -342,11 +342,11 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader {
|
||||
a.menuBtn = widget.NewButtonWithIcon("", theme.MoreHorizontalIcon(), nil)
|
||||
a.menuBtn.OnTapped = func() {
|
||||
if pop == nil {
|
||||
shuffleTracks := fyne.NewMenuItem("Shuffle tracks", func() {
|
||||
shuffleTracks := fyne.NewMenuItem(lang.L("Shuffle tracks"), func() {
|
||||
go a.artistPage.pm.PlayArtistDiscography(a.artistID, true /*shuffle*/)
|
||||
})
|
||||
shuffleTracks.Icon = myTheme.TracksIcon
|
||||
shuffleAlbums := fyne.NewMenuItem("Shuffle albums", func() {
|
||||
shuffleAlbums := fyne.NewMenuItem(lang.L("Shuffle albums"), func() {
|
||||
go a.artistPage.pm.ShuffleArtistAlbums(a.artistID)
|
||||
})
|
||||
shuffleAlbums.Icon = myTheme.AlbumIcon
|
||||
@@ -416,7 +416,7 @@ func (a *ArtistPageHeader) UpdateInfo(info *mediaprovider.ArtistInfo) {
|
||||
}
|
||||
|
||||
if len(a.similarArtists.Objects) == 0 {
|
||||
a.similarArtists.Add(widget.NewLabel("Similar Artists:"))
|
||||
a.similarArtists.Add(widget.NewLabel(lang.L("Similar artists") + ":"))
|
||||
}
|
||||
for _, obj := range a.similarArtists.Objects {
|
||||
obj.Hide()
|
||||
|
||||
@@ -365,9 +365,9 @@ func (a *FavoritesPage) onShowFavoriteArtists() {
|
||||
func buildArtistGridViewModel(artists []*mediaprovider.Artist) []widgets.GridViewItemModel {
|
||||
model := make([]widgets.GridViewItemModel, 0)
|
||||
for _, ar := range artists {
|
||||
albums := "albums"
|
||||
albums := lang.L("albums")
|
||||
if ar.AlbumCount == 1 {
|
||||
albums = "album"
|
||||
albums = lang.L("album")
|
||||
}
|
||||
model = append(model, widgets.GridViewItemModel{
|
||||
ID: ar.ID,
|
||||
|
||||
@@ -9,6 +9,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"
|
||||
@@ -149,7 +150,7 @@ func (g *GridViewPage[M, F]) createTitleAndSort() {
|
||||
|
||||
func (g *GridViewPage[M, F]) createSearchAndFilter() {
|
||||
g.searcher = widgets.NewSearchEntry()
|
||||
g.searcher.PlaceHolder = "Search page"
|
||||
g.searcher.PlaceHolder = lang.L("Search page")
|
||||
g.searcher.Text = g.searchText
|
||||
g.searcher.OnSearched = g.OnSearched
|
||||
g.filterBtn = g.adapter.FilterButton()
|
||||
|
||||
@@ -182,7 +182,7 @@ func NewNowPlayingPage(
|
||||
a.pm.LoadItems(items, backend.InsertNext, false)
|
||||
}
|
||||
a.lyricsViewer = widgets.NewLyricsViewer()
|
||||
a.statusLabel = widget.NewLabel("Stopped")
|
||||
a.statusLabel = widget.NewLabel(lang.L("Stopped"))
|
||||
|
||||
a.Reload()
|
||||
return a
|
||||
@@ -538,12 +538,13 @@ func (a *NowPlayingPage) formatStatusLine() {
|
||||
curPlayer := a.pm.CurrentPlayer()
|
||||
playerStats := curPlayer.GetStatus()
|
||||
lastStatus := a.statusLabel.Text
|
||||
state := "Stopped"
|
||||
stopped := lang.L("Stopped")
|
||||
state := stopped
|
||||
switch playerStats.State {
|
||||
case player.Paused:
|
||||
state = "Paused"
|
||||
state = lang.L("Paused")
|
||||
case player.Playing:
|
||||
state = "Playing"
|
||||
state = lang.L("Playing")
|
||||
}
|
||||
|
||||
dur := 0.0
|
||||
@@ -552,7 +553,7 @@ func (a *NowPlayingPage) formatStatusLine() {
|
||||
}
|
||||
statusSuffix := ""
|
||||
trackNum := 0
|
||||
if state != "Stopped" {
|
||||
if state != stopped {
|
||||
trackNum = a.pm.NowPlayingIndex() + 1
|
||||
statusSuffix = fmt.Sprintf(" %s/%s",
|
||||
util.SecondsToMMSS(playerStats.TimePos),
|
||||
@@ -562,14 +563,14 @@ func (a *NowPlayingPage) formatStatusLine() {
|
||||
len(a.queue), statusSuffix)
|
||||
|
||||
mediaInfo := ""
|
||||
if state != "Stopped" {
|
||||
if state != stopped {
|
||||
mediaInfo = a.formatMediaInfoStr(curPlayer)
|
||||
}
|
||||
if mediaInfo != "" {
|
||||
mediaInfo = " · " + mediaInfo
|
||||
}
|
||||
|
||||
a.statusLabel.Text = fmt.Sprintf("%s%s | Total time: %s", status, mediaInfo, util.SecondsToTimeString(a.totalTime))
|
||||
a.statusLabel.Text = fmt.Sprintf("%s%s | %s: %s", status, mediaInfo, lang.L("Total time"), util.SecondsToTimeString(a.totalTime))
|
||||
if lastStatus != a.statusLabel.Text {
|
||||
a.statusLabel.Refresh()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user