add translations for playlist add toast
This commit is contained in:
@@ -239,5 +239,10 @@
|
|||||||
"Sept": "Sept",
|
"Sept": "Sept",
|
||||||
"Oct": "Okt",
|
"Oct": "Okt",
|
||||||
"Nov": "Nov",
|
"Nov": "Nov",
|
||||||
"Dec": "Dec"
|
"Dec": "Dec",
|
||||||
|
|
||||||
|
"playlist.addedtracks": {
|
||||||
|
"one": "Added {{.trackCount}} track to playlist",
|
||||||
|
"other": "Added {{.trackCount}} tracks to playlist"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,5 +242,10 @@
|
|||||||
"Sept": "Sept",
|
"Sept": "Sept",
|
||||||
"Oct": "Oct",
|
"Oct": "Oct",
|
||||||
"Nov": "Nov",
|
"Nov": "Nov",
|
||||||
"Dec": "Dec"
|
"Dec": "Dec",
|
||||||
|
|
||||||
|
"playlist.addedtracks": {
|
||||||
|
"one": "Added one track to playlist",
|
||||||
|
"other": "Added {{.trackCount}} tracks to playlist"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,5 +241,10 @@
|
|||||||
"Sept": "Set",
|
"Sept": "Set",
|
||||||
"Oct": "Oct",
|
"Oct": "Oct",
|
||||||
"Nov": "Nov",
|
"Nov": "Nov",
|
||||||
"Dec": "Dic"
|
"Dec": "Dic",
|
||||||
|
|
||||||
|
"playlist.addedtracks": {
|
||||||
|
"one": "Se ha añadido una pista a la lista de reproducción",
|
||||||
|
"other": "Se han añadido {{.trackCount}} pistas a la lista de reproducción"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,5 +240,10 @@
|
|||||||
"Sept": "Sept",
|
"Sept": "Sept",
|
||||||
"Oct": "Oct",
|
"Oct": "Oct",
|
||||||
"Nov": "Nov",
|
"Nov": "Nov",
|
||||||
"Dec": "Déc"
|
"Dec": "Déc",
|
||||||
|
|
||||||
|
"playlist.addedtracks": {
|
||||||
|
"one": "Une piste ajoutée à la liste de lecture",
|
||||||
|
"other": "{{.trackCount}} pistes ajoutées à la liste de lecture"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,5 +238,10 @@
|
|||||||
"Sept": "Set",
|
"Sept": "Set",
|
||||||
"Oct": "Ott",
|
"Oct": "Ott",
|
||||||
"Nov": "Nov",
|
"Nov": "Nov",
|
||||||
"Dec": "Dic"
|
"Dec": "Dic",
|
||||||
|
|
||||||
|
"playlist.addedtracks": {
|
||||||
|
"one": "Added {{.trackCount}} track to playlist",
|
||||||
|
"other": "Added {{.trackCount}} tracks to playlist"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,5 +228,10 @@
|
|||||||
"Remove from queue": "キューから削除",
|
"Remove from queue": "キューから削除",
|
||||||
"Play song radio": "曲をラジオで再生",
|
"Play song radio": "曲をラジオで再生",
|
||||||
"to":"to",
|
"to":"to",
|
||||||
"by":"by"
|
"by":"by",
|
||||||
|
|
||||||
|
"playlist.addedtracks": {
|
||||||
|
"one": "Added {{.trackCount}} track to playlist",
|
||||||
|
"other": "Added {{.trackCount}} tracks to playlist"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,5 +228,10 @@
|
|||||||
"Remove from queue": "Usuń z kolejki odtwarzania",
|
"Remove from queue": "Usuń z kolejki odtwarzania",
|
||||||
"Play song radio": "Odtwórz mix utworów",
|
"Play song radio": "Odtwórz mix utworów",
|
||||||
"to":"do",
|
"to":"do",
|
||||||
"by":"przez"
|
"by":"przez",
|
||||||
|
|
||||||
|
"playlist.addedtracks": {
|
||||||
|
"one": "Added {{.trackCount}} track to playlist",
|
||||||
|
"other": "Added {{.trackCount}} tracks to playlist"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,5 +228,10 @@
|
|||||||
"Remove from queue": "Remover da fila",
|
"Remove from queue": "Remover da fila",
|
||||||
"Play song radio": "Reproduzir rádio da faixa",
|
"Play song radio": "Reproduzir rádio da faixa",
|
||||||
"to":"a",
|
"to":"a",
|
||||||
"by":"de"
|
"by":"de",
|
||||||
|
|
||||||
|
"playlist.addedtracks": {
|
||||||
|
"one": "Added {{.trackCount}} track to playlist",
|
||||||
|
"other": "Added {{.trackCount}} tracks to playlist"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,5 +230,10 @@
|
|||||||
"Sept": "Sept",
|
"Sept": "Sept",
|
||||||
"Oct": "Oct",
|
"Oct": "Oct",
|
||||||
"Nov": "Noiem",
|
"Nov": "Noiem",
|
||||||
"Dec": "Dec"
|
"Dec": "Dec",
|
||||||
|
|
||||||
|
"playlist.addedtracks": {
|
||||||
|
"one": "Added {{.trackCount}} track to playlist",
|
||||||
|
"other": "Added {{.trackCount}} tracks to playlist"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,5 +216,10 @@
|
|||||||
"Unset favorite": "取消收藏",
|
"Unset favorite": "取消收藏",
|
||||||
"Remove from queue": "从队列中移除",
|
"Remove from queue": "从队列中移除",
|
||||||
"Size": "大小",
|
"Size": "大小",
|
||||||
"Play song radio": "播放歌曲电台"
|
"Play song radio": "播放歌曲电台",
|
||||||
|
|
||||||
|
"playlist.addedtracks": {
|
||||||
|
"one": "Added {{.trackCount}} track to playlist",
|
||||||
|
"other": "Added {{.trackCount}} tracks to playlist"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,5 +216,10 @@
|
|||||||
"Unset favorite": "取消收藏",
|
"Unset favorite": "取消收藏",
|
||||||
"Remove from queue": "从队列中移除",
|
"Remove from queue": "从队列中移除",
|
||||||
"Size": "大小",
|
"Size": "大小",
|
||||||
"Play song radio": "播放歌曲电台"
|
"Play song radio": "播放歌曲电台",
|
||||||
|
|
||||||
|
"playlist.addedtracks": {
|
||||||
|
"one": "Added {{.trackCount}} track to playlist",
|
||||||
|
"other": "Added {{.trackCount}} tracks to playlist"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -304,14 +305,18 @@ func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
|
|||||||
m.doModalClosed()
|
m.doModalClosed()
|
||||||
})
|
})
|
||||||
sp.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string) {
|
sp.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string) {
|
||||||
|
notifySuccess := func(n int) {
|
||||||
|
msg := lang.LocalizePluralKey("playlist.addedtracks",
|
||||||
|
"Added tracks to playlist", n, map[string]string{"trackCount": strconv.Itoa(n)})
|
||||||
|
m.ToastProvider.ShowSuccessToast(msg)
|
||||||
|
}
|
||||||
pop.Hide()
|
pop.Hide()
|
||||||
m.App.Config.Application.AddToPlaylistSkipDuplicates = sp.SkipDuplicates
|
m.App.Config.Application.AddToPlaylistSkipDuplicates = sp.SkipDuplicates
|
||||||
if id == "" /* creating new playlist */ {
|
if id == "" /* creating new playlist */ {
|
||||||
go func() {
|
go func() {
|
||||||
err := m.App.ServerManager.Server.CreatePlaylist(sp.SearchDialog.SearchQuery(), trackIDs)
|
err := m.App.ServerManager.Server.CreatePlaylist(sp.SearchDialog.SearchQuery(), trackIDs)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// TODO: translate, adjust by plurality
|
notifySuccess(len(trackIDs))
|
||||||
m.ToastProvider.ShowSuccessToast(fmt.Sprintf("Added %d tracks to playlist", len(trackIDs)))
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
} else {
|
} else {
|
||||||
@@ -331,8 +336,7 @@ func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
|
|||||||
})
|
})
|
||||||
err := m.App.ServerManager.Server.AddPlaylistTracks(id, filterTrackIDs)
|
err := m.App.ServerManager.Server.AddPlaylistTracks(id, filterTrackIDs)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// TODO: translate, adjust by plurality
|
notifySuccess(len(filterTrackIDs))
|
||||||
m.ToastProvider.ShowSuccessToast(fmt.Sprintf("Added %d tracks to playlist", len(filterTrackIDs)))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -340,8 +344,7 @@ func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
|
|||||||
go func() {
|
go func() {
|
||||||
err := m.App.ServerManager.Server.AddPlaylistTracks(id, trackIDs)
|
err := m.App.ServerManager.Server.AddPlaylistTracks(id, trackIDs)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// TODO: translate, adjust by plurality
|
notifySuccess(len(trackIDs))
|
||||||
m.ToastProvider.ShowSuccessToast(fmt.Sprintf("Added %d tracks to playlist", len(trackIDs)))
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-3
@@ -16,6 +16,11 @@ import (
|
|||||||
"github.com/dweymouth/supersonic/ui/widgets"
|
"github.com/dweymouth/supersonic/ui/widgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
toastAutoDismissalTime = 3 * time.Second
|
||||||
|
toastAnimationDuration = 100 * time.Millisecond
|
||||||
|
)
|
||||||
|
|
||||||
type ToastOverlay struct {
|
type ToastOverlay struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
@@ -46,7 +51,7 @@ func (t *ToastOverlay) ShowSuccessToast(message string) {
|
|||||||
endPos := fyne.NewPos(s.Width-min.Width-pad, s.Height-min.Height-pad)
|
endPos := fyne.NewPos(s.Width-min.Width-pad, s.Height-min.Height-pad)
|
||||||
startPos := fyne.NewPos(s.Width, endPos.Y)
|
startPos := fyne.NewPos(s.Width, endPos.Y)
|
||||||
f := t.makeToastAnimFunc(endPos, false)
|
f := t.makeToastAnimFunc(endPos, false)
|
||||||
t.currentToastAnim = canvas.NewPositionAnimation(startPos, endPos, 100*time.Millisecond, f)
|
t.currentToastAnim = canvas.NewPositionAnimation(startPos, endPos, toastAnimationDuration, f)
|
||||||
t.currentToastAnim.Curve = fyne.AnimationEaseOut
|
t.currentToastAnim.Curve = fyne.AnimationEaseOut
|
||||||
t.currentToastAnim.Start()
|
t.currentToastAnim.Start()
|
||||||
t.Refresh()
|
t.Refresh()
|
||||||
@@ -54,7 +59,7 @@ func (t *ToastOverlay) ShowSuccessToast(message string) {
|
|||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
t.dismissCancel = cancel // always canceled by dismissToast
|
t.dismissCancel = cancel // always canceled by dismissToast
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(2 * time.Second)
|
time.Sleep(toastAutoDismissalTime)
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
@@ -120,7 +125,7 @@ func (t *ToastOverlay) dismissToast() {
|
|||||||
startPos := fyne.NewPos(s.Width-min.Width-pad, s.Height-min.Height-pad)
|
startPos := fyne.NewPos(s.Width-min.Width-pad, s.Height-min.Height-pad)
|
||||||
endPos := fyne.NewPos(s.Width, startPos.Y)
|
endPos := fyne.NewPos(s.Width, startPos.Y)
|
||||||
f := t.makeToastAnimFunc(endPos, true)
|
f := t.makeToastAnimFunc(endPos, true)
|
||||||
t.currentToastAnim = canvas.NewPositionAnimation(startPos, endPos, 100*time.Millisecond, f)
|
t.currentToastAnim = canvas.NewPositionAnimation(startPos, endPos, toastAnimationDuration, f)
|
||||||
t.currentToastAnim.Curve = fyne.AnimationEaseIn
|
t.currentToastAnim.Curve = fyne.AnimationEaseIn
|
||||||
t.currentToastAnim.Start()
|
t.currentToastAnim.Start()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user