and some more
This commit is contained in:
@@ -9,6 +9,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"
|
||||
@@ -37,7 +38,7 @@ func NewAboutDialog(version string) *AboutDialog {
|
||||
widget.NewSeparator(),
|
||||
container.NewHBox(
|
||||
layout.NewSpacer(),
|
||||
widget.NewButton("Close", func() {
|
||||
widget.NewButton(lang.L("Close"), func() {
|
||||
if a.OnDismiss != nil {
|
||||
a.OnDismiss()
|
||||
}
|
||||
@@ -59,7 +60,7 @@ func (a *AboutDialog) buildMainTabContainer(version string) *fyne.Container {
|
||||
title.Segments[0].(*widget.TextSegment).Style.TextStyle.Bold = true
|
||||
title.Segments[0].(*widget.TextSegment).Style.SizeName = theme.SizeNameSubHeadingText
|
||||
title.Segments[0].(*widget.TextSegment).Style.Alignment = fyne.TextAlignCenter
|
||||
versionLbl := newCenterAlignLabel(fmt.Sprintf("version %s", version))
|
||||
versionLbl := newCenterAlignLabel(fmt.Sprintf("%s %s", lang.L("version"), version))
|
||||
copyright := newCenterAlignLabel(res.Copyright)
|
||||
license := widget.NewRichTextWithText("GNU General Public License version 3 (GPL v3)")
|
||||
ts := license.Segments[0].(*widget.TextSegment)
|
||||
@@ -69,9 +70,9 @@ func (a *AboutDialog) buildMainTabContainer(version string) *fyne.Container {
|
||||
kofiUrl, _ := url.Parse(res.KofiURL)
|
||||
githubKofi := container.NewCenter(
|
||||
container.New(layout.NewCustomPaddedHBoxLayout(-10),
|
||||
widget.NewHyperlink("Github page", ghUrl),
|
||||
widget.NewHyperlink(lang.L("Github page"), ghUrl),
|
||||
widget.NewLabel("·"),
|
||||
widget.NewHyperlink("Support the project", kofiUrl)),
|
||||
widget.NewHyperlink(lang.L("Support the project"), kofiUrl)),
|
||||
)
|
||||
|
||||
return container.New(&layout.CustomPaddedLayout{TopPadding: 10, BottomPadding: 10},
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package dialogs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/dweymouth/supersonic/backend"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
@@ -68,7 +70,7 @@ func NewAddEditServerDialog(title string, cancelable bool, prefillServer *backen
|
||||
userField := widget.NewEntryWithData(binding.BindString(&a.Username))
|
||||
userField.OnSubmitted = func(_ string) { focusHandler(a.passField) }
|
||||
altHostField := widget.NewEntryWithData(binding.BindString(&a.AltHost))
|
||||
altHostField.SetPlaceHolder(lang.L("(optional)") + " https://my-external-domain.net/music")
|
||||
altHostField.SetPlaceHolder(fmt.Sprintf("(%s)", lang.L("optional")) + " https://my-external-domain.net/music")
|
||||
altHostField.OnSubmitted = func(_ string) { focusHandler(userField) }
|
||||
hostField := widget.NewEntryWithData(binding.BindString(&a.Host))
|
||||
hostField.SetPlaceHolder("http://localhost:4533")
|
||||
|
||||
@@ -8,6 +8,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"
|
||||
|
||||
@@ -270,11 +271,11 @@ func (s *searchResult) Update(result *mediaprovider.SearchResult) {
|
||||
s.imageLoader.Load(result.CoverID)
|
||||
s.title.SetText(result.Name)
|
||||
|
||||
maybePluralize := func(s string, size int) string {
|
||||
maybePluralize := func(key string, size int) string {
|
||||
if size != 1 {
|
||||
return s + "s"
|
||||
return lang.L(key + "s")
|
||||
}
|
||||
return s
|
||||
return lang.L(key)
|
||||
}
|
||||
var secondaryText string
|
||||
switch result.Type {
|
||||
|
||||
@@ -160,16 +160,18 @@ func (s *SettingsDialog) createGeneralTab(canSaveQueueToServer bool) *container.
|
||||
systemTrayEnable.Checked = s.config.Application.EnableSystemTray
|
||||
|
||||
// save play queue settings
|
||||
saveToServer := widget.NewRadioGroup([]string{"Locally", "To server"}, func(choice string) {
|
||||
s.config.Application.SaveQueueToServer = choice == "To server"
|
||||
locally := lang.L("Locally")
|
||||
toServer := lang.L("To server")
|
||||
saveToServer := widget.NewRadioGroup([]string{locally, toServer}, func(choice string) {
|
||||
s.config.Application.SaveQueueToServer = choice == toServer
|
||||
})
|
||||
saveToServer.Horizontal = true
|
||||
if !s.config.Application.SavePlayQueue {
|
||||
saveToServer.Disable()
|
||||
}
|
||||
saveToServer.Selected = "Locally"
|
||||
saveToServer.Selected = locally
|
||||
if s.config.Application.SaveQueueToServer {
|
||||
saveToServer.Selected = "To server"
|
||||
saveToServer.Selected = toServer
|
||||
}
|
||||
saveQueue := widget.NewCheck(lang.L("Save play queue on exit"), func(save bool) {
|
||||
s.config.Application.SavePlayQueue = save
|
||||
@@ -233,7 +235,7 @@ func (s *SettingsDialog) createGeneralTab(canSaveQueueToServer bool) *container.
|
||||
if lastScrobbleText == "" {
|
||||
lastScrobbleText = "4" // default scrobble minutes
|
||||
}
|
||||
durationEnabled := widget.NewCheck("or when", func(checked bool) {
|
||||
durationEnabled := widget.NewCheck(lang.L("or when"), func(checked bool) {
|
||||
if !checked {
|
||||
s.config.Scrobbling.ThresholdTimeSeconds = -1
|
||||
lastScrobbleText = durationEntry.Text
|
||||
@@ -292,14 +294,14 @@ func (s *SettingsDialog) createGeneralTab(canSaveQueueToServer bool) *container.
|
||||
widget.NewRichText(&widget.TextSegment{Text: "Scrobbling", Style: util.BoldRichTextStyle}),
|
||||
scrobbleEnabled,
|
||||
container.NewHBox(
|
||||
widget.NewLabel("Scrobble when"),
|
||||
widget.NewLabel(lang.L("Scrobble when")),
|
||||
percentEntry,
|
||||
widget.NewLabel("percent of track is played"),
|
||||
widget.NewLabel(lang.L("percent of track is played")),
|
||||
),
|
||||
container.NewHBox(
|
||||
durationEnabled,
|
||||
durationEntry,
|
||||
widget.NewLabel("minutes of track have been played"),
|
||||
widget.NewLabel(lang.L("minutes of track have been played")),
|
||||
),
|
||||
))
|
||||
}
|
||||
@@ -324,7 +326,7 @@ func (s *SettingsDialog) createPlaybackTab(isLocalPlayer, isReplayGainPlayer boo
|
||||
}
|
||||
}
|
||||
|
||||
replayGainSelect := widget.NewSelect([]string{"None", "Album", "Track", "Auto"}, nil)
|
||||
replayGainSelect := widget.NewSelect([]string{lang.L("None"), lang.L("Album"), lang.L("Track"), lang.L("Auto")}, nil)
|
||||
replayGainSelect.OnChanged = func(_ string) {
|
||||
switch replayGainSelect.SelectedIndex() {
|
||||
case 0:
|
||||
@@ -377,7 +379,7 @@ func (s *SettingsDialog) createPlaybackTab(isLocalPlayer, isReplayGainPlayer boo
|
||||
})
|
||||
preventClipping.Checked = s.config.ReplayGain.PreventClipping
|
||||
|
||||
audioExclusive := widget.NewCheck("Audio exclusive mode", func(checked bool) {
|
||||
audioExclusive := widget.NewCheck(lang.L("Exclusive mode"), func(checked bool) {
|
||||
s.config.LocalPlayback.AudioExclusive = checked
|
||||
s.onAudioExclusiveSettingsChanged()
|
||||
})
|
||||
@@ -393,20 +395,20 @@ func (s *SettingsDialog) createPlaybackTab(isLocalPlayer, isReplayGainPlayer boo
|
||||
preampGain.Disable()
|
||||
}
|
||||
|
||||
return container.NewTabItem("Playback", container.NewVBox(
|
||||
return container.NewTabItem(lang.L("Playback"), container.NewVBox(
|
||||
disableTranscode,
|
||||
container.New(&layout.CustomPaddedLayout{TopPadding: 5},
|
||||
container.New(layout.NewFormLayout(),
|
||||
widget.NewLabel("Audio device"), container.NewBorder(nil, nil, nil, util.NewHSpace(70), deviceSelect),
|
||||
widget.NewLabel(lang.L("Audio device")), container.NewBorder(nil, nil, nil, util.NewHSpace(70), deviceSelect),
|
||||
layout.NewSpacer(), audioExclusive,
|
||||
)),
|
||||
s.newSectionSeparator(),
|
||||
|
||||
widget.NewRichText(&widget.TextSegment{Text: "ReplayGain", Style: util.BoldRichTextStyle}),
|
||||
container.New(layout.NewFormLayout(),
|
||||
widget.NewLabel("ReplayGain mode"), container.NewGridWithColumns(2, replayGainSelect),
|
||||
widget.NewLabel("ReplayGain preamp"), container.NewHBox(preampGain, widget.NewLabel("dB")),
|
||||
widget.NewLabel("Prevent clipping"), preventClipping,
|
||||
widget.NewLabel(lang.L("ReplayGain mode")), container.NewGridWithColumns(2, replayGainSelect),
|
||||
widget.NewLabel(lang.L("ReplayGain preamp")), container.NewHBox(preampGain, widget.NewLabel("dB")),
|
||||
widget.NewLabel(lang.L("Prevent clipping")), preventClipping,
|
||||
),
|
||||
))
|
||||
}
|
||||
@@ -487,7 +489,7 @@ func (s *SettingsDialog) createExperimentalTab(window fyne.Window) *container.Ta
|
||||
return container.NewTabItem("Experimental", container.NewVBox(
|
||||
warningLabel,
|
||||
s.newSectionSeparator(),
|
||||
widget.NewRichText(&widget.TextSegment{Text: "UI Scaling", Style: util.BoldRichTextStyle}),
|
||||
widget.NewRichText(&widget.TextSegment{Text: lang.L("UI Scaling"), Style: util.BoldRichTextStyle}),
|
||||
uiScaleRadio,
|
||||
s.newSectionSeparator(),
|
||||
widget.NewRichText(&widget.TextSegment{Text: "Application Font", Style: util.BoldRichTextStyle}),
|
||||
|
||||
Reference in New Issue
Block a user