More localization fixes

This commit is contained in:
Arkadiusz Fal 2022-09-27 15:22:40 +02:00
parent c86e9d95d1
commit 7573b0321c
4 changed files with 11 additions and 18 deletions

View File

@ -26,7 +26,7 @@ struct ControlsOverlay: View {
var body: some View { var body: some View {
ScrollView { ScrollView {
VStack { VStack {
Section(header: controlsHeader("Rate & Captions")) { Section(header: controlsHeader("Rate & Captions".localized())) {
HStack(spacing: rateButtonsSpacing) { HStack(spacing: rateButtonsSpacing) {
decreaseRateButton decreaseRateButton
#if os(tvOS) #if os(tvOS)
@ -50,14 +50,14 @@ struct ControlsOverlay: View {
#endif #endif
} }
Section(header: controlsHeader("Quality Profile")) { Section(header: controlsHeader("Quality Profile".localized())) {
qualityProfileButton qualityProfileButton
#if os(tvOS) #if os(tvOS)
.focused($focusedField, equals: .qualityProfile) .focused($focusedField, equals: .qualityProfile)
#endif #endif
} }
Section(header: controlsHeader("Stream & Player")) { Section(header: controlsHeader("Stream & Player".localized())) {
qualityButton qualityButton
#if os(tvOS) #if os(tvOS)
.focused($focusedField, equals: .stream) .focused($focusedField, equals: .stream)
@ -71,7 +71,7 @@ struct ControlsOverlay: View {
if player.activeBackend == .mpv, if player.activeBackend == .mpv,
showMPVPlaybackStats showMPVPlaybackStats
{ {
Section(header: controlsHeader("Statistics")) { Section(header: controlsHeader("Statistics".localized())) {
PlaybackStatsView() PlaybackStatsView()
} }
#if os(tvOS) #if os(tvOS)

View File

@ -14,7 +14,7 @@ struct OpeningStream: View {
} }
var reason: String { var reason: String {
guard player.videoBeingOpened != nil else { guard player.videoBeingOpened == nil else {
return "Loading streams...".localized() return "Loading streams...".localized()
} }
@ -22,19 +22,12 @@ struct OpeningStream: View {
return "Opening audio stream...".localized() return "Opening audio stream...".localized()
} }
return String(format: "Opening %@ stream...".localized(), streamQuality) return String(format: "Opening %@ stream...".localized(), player.streamSelection?.shortQuality ?? "")
} }
var state: String? { var state: String? {
player.videoBeingOpened.isNil ? model.bufferingStateText : nil player.videoBeingOpened.isNil ? model.bufferingStateText : nil
} }
var streamQuality: String {
guard let stream = player.streamSelection else { return " " }
guard !player.musicMode else { return " audio " }
return " \(stream.shortQuality) "
}
} }
struct OpeningStream_Previews: PreviewProvider { struct OpeningStream_Previews: PreviewProvider {

View File

@ -7,10 +7,10 @@ struct PlaybackStatsView: View {
var body: some View { var body: some View {
VStack(alignment: .leading, spacing: 6) { VStack(alignment: .leading, spacing: 6) {
mpvPlaybackStatRow("Hardware decoder", player.mpvBackend.hwDecoder) mpvPlaybackStatRow("Hardware decoder".localized(), player.mpvBackend.hwDecoder)
mpvPlaybackStatRow("Dropped frames", String(player.mpvBackend.frameDropCount)) mpvPlaybackStatRow("Dropped frames".localized(), String(player.mpvBackend.frameDropCount))
mpvPlaybackStatRow("Stream FPS", String(format: "%.2ffps", player.mpvBackend.outputFps)) mpvPlaybackStatRow("Stream FPS".localized(), String(format: "%.2ffps", player.mpvBackend.outputFps))
mpvPlaybackStatRow("Cached time", String(format: "%.2fs", player.mpvBackend.cacheDuration)) mpvPlaybackStatRow("Cached time".localized(), String(format: "%.2fs", player.mpvBackend.cacheDuration))
} }
.padding(.top, 2) .padding(.top, 2)
#if os(tvOS) #if os(tvOS)

View File

@ -209,7 +209,7 @@ struct PlayerSettings: View {
} }
private var fullScreenPlayerControlsLayoutPicker: some View { private var fullScreenPlayerControlsLayoutPicker: some View {
Picker("Fullscreen Size", selection: $fullScreenPlayerControlsLayout) { Picker("Fullscreen size", selection: $fullScreenPlayerControlsLayout) {
ForEach(PlayerControlsLayout.allCases.filter(\.available), id: \.self) { layout in ForEach(PlayerControlsLayout.allCases.filter(\.available), id: \.self) { layout in
Text(layout.description).tag(layout.rawValue) Text(layout.description).tag(layout.rawValue)
} }