From 8e829ed3b1db2a7a7d152d75c30067b554f92174 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 22 Apr 2023 23:10:05 +0200 Subject: [PATCH] Localizations fixes --- Shared/Player/PlaybackSettings.swift | 14 +++++++------- Shared/Settings/AdvancedSettings.swift | 5 +++-- Shared/Settings/BrowsingSettings.swift | 6 +++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Shared/Player/PlaybackSettings.swift b/Shared/Player/PlaybackSettings.swift index aaf129a3..92152cf3 100644 --- a/Shared/Player/PlaybackSettings.swift +++ b/Shared/Player/PlaybackSettings.swift @@ -63,14 +63,14 @@ struct PlaybackSettings: View { } HStack { - controlsHeader("Playback Mode") + controlsHeader("Playback Mode".localized()) Spacer() playbackModeControl } .padding(.vertical, 10) HStack { - controlsHeader("Rate") + controlsHeader("Rate".localized()) Spacer() HStack(spacing: rateButtonsSpacing) { decreaseRateButton @@ -86,7 +86,7 @@ struct PlaybackSettings: View { } if player.activeBackend == .mpv { HStack { - controlsHeader("Captions") + controlsHeader("Captions".localized()) Spacer() captionsButton #if os(tvOS) @@ -292,7 +292,7 @@ struct PlaybackSettings: View { Button { player.playbackMode = player.playbackMode.next() } label: { - Label(player.playbackMode.description, systemImage: player.playbackMode.systemImage) + Label(player.playbackMode.description.localized(), systemImage: player.playbackMode.systemImage) .transaction { t in t.animation = nil } .frame(minWidth: 350) } @@ -306,7 +306,7 @@ struct PlaybackSettings: View { Menu { playbackModePicker } label: { - Label(player.playbackMode.description, systemImage: player.playbackMode.systemImage) + Label(player.playbackMode.description.localized(), systemImage: player.playbackMode.systemImage) } .transaction { t in t.animation = .none } #endif @@ -315,7 +315,7 @@ struct PlaybackSettings: View { var playbackModePicker: some View { Picker("Playback Mode", selection: $player.playbackMode) { ForEach(PlayerModel.PlaybackMode.allCases, id: \.rawValue) { mode in - Label(mode.description, systemImage: mode.systemImage).tag(mode) + Label(mode.description.localized(), systemImage: mode.systemImage).tag(mode) } } .labelsHidden() @@ -437,7 +437,7 @@ struct PlaybackSettings: View { @ViewBuilder private var captionsPicker: some View { let captions = player.currentVideo?.captions ?? [] - Picker("Captions", selection: $player.captions) { + Picker("Captions".localized(), selection: $player.captions) { if captions.isEmpty { Text("Not available") } else { diff --git a/Shared/Settings/AdvancedSettings.swift b/Shared/Settings/AdvancedSettings.swift index 58f7ec88..1f50c4f9 100644 --- a/Shared/Settings/AdvancedSettings.swift +++ b/Shared/Settings/AdvancedSettings.swift @@ -137,12 +137,13 @@ struct AdvancedSettings: View { HStack { Text("Maximum feed items") .frame(minWidth: 200, alignment: .leading) + .multilineTextAlignment(.leading) TextField("Limit", text: $feedCacheSize) + .multilineTextAlignment(.trailing) #if !os(macOS) .keyboardType(.numberPad) #endif } - .multilineTextAlignment(.trailing) } private var showCacheStatusToggle: some View { @@ -167,7 +168,7 @@ struct AdvancedSettings: View { } var cacheSize: some View { - Text(String(format: "Total size: %@", BaseCacheModel.shared.totalSizeFormatted)) + Text(String(format: "Total size: %@".localized(), BaseCacheModel.shared.totalSizeFormatted)) .foregroundColor(.secondary) } } diff --git a/Shared/Settings/BrowsingSettings.swift b/Shared/Settings/BrowsingSettings.swift index 6f364ade..e7783528 100644 --- a/Shared/Settings/BrowsingSettings.swift +++ b/Shared/Settings/BrowsingSettings.swift @@ -166,8 +166,8 @@ struct BrowsingSettings: View { Section(header: SettingsHeader(text: "Player Bar".localized()), footer: playerBarFooter) { Toggle("Open expanded", isOn: $playerButtonIsExpanded) Toggle("Always show controls buttons", isOn: $playerButtonShowsControlButtonsWhenMinimized) - playerBarGesturePicker("Single tap gesture", selection: $playerButtonSingleTapGesture) - playerBarGesturePicker("Double tap gesture", selection: $playerButtonDoubleTapGesture) + playerBarGesturePicker("Single tap gesture".localized(), selection: $playerButtonSingleTapGesture) + playerBarGesturePicker("Double tap gesture".localized(), selection: $playerButtonDoubleTapGesture) HStack { Text("Maximum width expanded") Spacer() @@ -185,7 +185,7 @@ struct BrowsingSettings: View { func playerBarGesturePicker(_ label: String, selection: Binding) -> some View { Picker(label, selection: selection) { ForEach(PlayerTapGestureAction.allCases, id: \.rawValue) { action in - Text(action.label).tag(action) + Text(action.label.localized()).tag(action) } } }