From 1dbb0b89240a5983de94d7f8865000b3351f5c8d Mon Sep 17 00:00:00 2001 From: Aiden Vigue Date: Fri, 16 Jul 2021 20:06:37 -0400 Subject: [PATCH] Add english localization file --- JellyfinPlayer tvOS/ConnectToServerView.swift | 8 +-- JellyfinPlayer tvOS/MainTabView.swift | 13 +---- .../VideoPlayer/AudioView.swift | 2 +- .../VideoPlayer/MediaInfoView.swift | 2 +- .../VideoPlayer/SubtitlesView.swift | 2 +- JellyfinPlayer.xcodeproj/project.pbxproj | 55 ++++++++++++++++--- .../Components/PortraitItemView.swift | 16 ++++-- JellyfinPlayer/ConnectToServerView.swift | 8 +-- JellyfinPlayer/ContinueWatchingView.swift | 3 +- JellyfinPlayer/HomeView.swift | 2 +- JellyfinPlayer/LibraryFilterView.swift | 8 +-- JellyfinPlayer/LibraryListView.swift | 2 +- JellyfinPlayer/MainTabView.swift | 13 +---- JellyfinPlayer/SearchBarView.swift | 2 +- JellyfinPlayer/SettingsView.swift | 4 +- .../VideoPlayerCastDeviceSelector.swift | 2 +- JellyfinPlayer/VideoPlayerSettingsView.swift | 14 ++--- 17 files changed, 87 insertions(+), 69 deletions(-) diff --git a/JellyfinPlayer tvOS/ConnectToServerView.swift b/JellyfinPlayer tvOS/ConnectToServerView.swift index 998e3689..8701e2da 100644 --- a/JellyfinPlayer tvOS/ConnectToServerView.swift +++ b/JellyfinPlayer tvOS/ConnectToServerView.swift @@ -20,7 +20,7 @@ struct ConnectToServerView: View { if viewModel.publicUsers.isEmpty { Section(header: Text(viewModel.lastPublicUsers.isEmpty || username == "" ? "Login to \(ServerEnvironment.current.server.name ?? "")": "")) { if viewModel.lastPublicUsers.isEmpty || username == "" { - TextField("Username", text: $username) + TextField(NSLocalizedString("Username", comment: ""), text: $username) .disableAutocorrection(true) .autocapitalization(.none) } else { @@ -33,7 +33,7 @@ struct ConnectToServerView: View { } } - SecureField("Password (optional)", text: $password) + SecureField(NSLocalizedString("Password", comment: ""), text: $password) .disableAutocorrection(true) .autocapitalization(.none) } @@ -108,7 +108,7 @@ struct ConnectToServerView: View { Form { Section(header: Text("Server Information")) { - TextField("Jellyfin Server URL", text: $uri) + TextField(NSLocalizedString("Server URL", comment: ""), text: $uri) .disableAutocorrection(true) .autocapitalization(.none) Button { @@ -170,6 +170,6 @@ struct ConnectToServerView: View { .onChange(of: password) { password in viewModel.passwordSubject.send(password) } - .navigationTitle(viewModel.isConnectedServer ? "Who's watching?" : "Connect to Jellyfin") + .navigationTitle(viewModel.isConnectedServer ? NSLocalizedString("Who's watching?", comment: "") : NSLocalizedString("Connect to Jellyfin", comment: "")) } } diff --git a/JellyfinPlayer tvOS/MainTabView.swift b/JellyfinPlayer tvOS/MainTabView.swift index bd1b243f..e3e99199 100644 --- a/JellyfinPlayer tvOS/MainTabView.swift +++ b/JellyfinPlayer tvOS/MainTabView.swift @@ -42,14 +42,14 @@ struct MainTabView: View { HomeView() .offset(y: -1) // don't remove this. it breaks tabview on 4K displays. .tabItem { - Text(Tab.home.localized) + Text("All Media") Image(systemName: "house") } .tag(Tab.home) Text("Library") .tabItem { - Text(Tab.allMedia.localized) + Text("Home") Image(systemName: "folder") } .tag(Tab.allMedia) @@ -62,15 +62,6 @@ extension MainTabView { enum Tab: String { case home case allMedia - - var localized: String { - switch self { - case .home: - return "Home" - case .allMedia: - return "All Media" - } - } } } diff --git a/JellyfinPlayer tvOS/VideoPlayer/AudioView.swift b/JellyfinPlayer tvOS/VideoPlayer/AudioView.swift index 9b198f94..3d5b4162 100644 --- a/JellyfinPlayer tvOS/VideoPlayer/AudioView.swift +++ b/JellyfinPlayer tvOS/VideoPlayer/AudioView.swift @@ -14,7 +14,7 @@ class AudioViewController: InfoTabViewController { override func viewDidLoad() { super.viewDidLoad() - tabBarItem.title = "Audio" + tabBarItem.title = NSLocalizedString("Audio", comment: "") } diff --git a/JellyfinPlayer tvOS/VideoPlayer/MediaInfoView.swift b/JellyfinPlayer tvOS/VideoPlayer/MediaInfoView.swift index 4be09ea5..f2cf2642 100644 --- a/JellyfinPlayer tvOS/VideoPlayer/MediaInfoView.swift +++ b/JellyfinPlayer tvOS/VideoPlayer/MediaInfoView.swift @@ -16,7 +16,7 @@ class MediaInfoViewController: InfoTabViewController { override func viewDidLoad() { super.viewDidLoad() - tabBarItem.title = "Info" + tabBarItem.title = NSLocalizedString("Info", comment: "") } func setMedia(item: BaseItemDto) { diff --git a/JellyfinPlayer tvOS/VideoPlayer/SubtitlesView.swift b/JellyfinPlayer tvOS/VideoPlayer/SubtitlesView.swift index a4e35717..240d6828 100644 --- a/JellyfinPlayer tvOS/VideoPlayer/SubtitlesView.swift +++ b/JellyfinPlayer tvOS/VideoPlayer/SubtitlesView.swift @@ -14,7 +14,7 @@ class SubtitlesViewController: InfoTabViewController { override func viewDidLoad() { super.viewDidLoad() - tabBarItem.title = "Subtitles" + tabBarItem.title = NSLocalizedString("Subtitles", comment: "") } diff --git a/JellyfinPlayer.xcodeproj/project.pbxproj b/JellyfinPlayer.xcodeproj/project.pbxproj index 41fea505..eccc29a6 100644 --- a/JellyfinPlayer.xcodeproj/project.pbxproj +++ b/JellyfinPlayer.xcodeproj/project.pbxproj @@ -106,6 +106,9 @@ 53ABFDEE26799DCD00886593 /* ImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531AC8BE26750DE20091C7EB /* ImageView.swift */; }; 53AD124D267029D60094A276 /* SeriesItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53987CA526572F0700E7EA70 /* SeriesItemView.swift */; }; 53AD124E26702B8A0094A276 /* SeasonItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53987CA326572C1300E7EA70 /* SeasonItemView.swift */; }; + 53AFFDE926A2520800261FD0 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 53AFFDE726A2520800261FD0 /* Localizable.strings */; }; + 53AFFDEA26A2520800261FD0 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 53AFFDE726A2520800261FD0 /* Localizable.strings */; }; + 53AFFDEB26A2520800261FD0 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 53AFFDE726A2520800261FD0 /* Localizable.strings */; }; 53CD2A40268A49C2002ABD4E /* ItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53CD2A3F268A49C2002ABD4E /* ItemView.swift */; }; 53CD2A42268A4B38002ABD4E /* MovieItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53CD2A41268A4B38002ABD4E /* MovieItemView.swift */; }; 53DE4BD02670961400739748 /* EpisodeItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53987CA72657424A00E7EA70 /* EpisodeItemView.swift */; }; @@ -305,6 +308,8 @@ 53ABFDDD267974E300886593 /* SplashView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashView.swift; sourceTree = ""; }; 53ABFDEA2679753200886593 /* ConnectToServerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectToServerView.swift; sourceTree = ""; }; 53AD124C2670278D0094A276 /* JellyfinPlayer.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = JellyfinPlayer.entitlements; sourceTree = ""; }; + 53AFFDE826A2520800261FD0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Localizable.strings; sourceTree = ""; }; + 53AFFDEC26A2523300261FD0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = ../es.lproj/Localizable.strings; sourceTree = ""; }; 53CD2A3F268A49C2002ABD4E /* ItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemView.swift; sourceTree = ""; }; 53CD2A41268A4B38002ABD4E /* MovieItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieItemView.swift; sourceTree = ""; }; 53D5E3DC264B47EE00BADDC8 /* MobileVLCKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MobileVLCKit.xcframework; path = Carthage/Build/MobileVLCKit.xcframework; sourceTree = ""; }; @@ -535,6 +540,7 @@ 5377CBE8263B596A003A4E83 = { isa = PBXGroup; children = ( + 53AFFDE626A2520800261FD0 /* en.lproj */, 53D5E3DB264B47EE00BADDC8 /* Frameworks */, 5377CBF3263B596A003A4E83 /* JellyfinPlayer */, 535870612669D21600D05A09 /* JellyfinPlayer tvOS */, @@ -601,6 +607,14 @@ path = "Preview Content"; sourceTree = ""; }; + 53AFFDE626A2520800261FD0 /* en.lproj */ = { + isa = PBXGroup; + children = ( + 53AFFDE726A2520800261FD0 /* Localizable.strings */, + ); + path = en.lproj; + sourceTree = SOURCE_ROOT; + }; 53D5E3DB264B47EE00BADDC8 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -824,7 +838,7 @@ hasScannedForEncodings = 0; knownRegions = ( en, - Base, + es, ); mainGroup = 5377CBE8263B596A003A4E83; packageReferences = ( @@ -856,6 +870,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 53AFFDEA26A2520800261FD0 /* Localizable.strings in Resources */, 5310695D2684E7EE00CFFDBA /* VideoPlayer.storyboard in Resources */, 5358706A2669D21700D05A09 /* Preview Assets.xcassets in Resources */, 535870672669D21700D05A09 /* Assets.xcassets in Resources */, @@ -867,6 +882,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 53AFFDE926A2520800261FD0 /* Localizable.strings in Resources */, 5377CBFC263B596B003A4E83 /* Preview Assets.xcassets in Resources */, 53313B90265EEA6D00947AA3 /* VideoPlayer.storyboard in Resources */, AE8C3159265D6F90008AA076 /* bitrates.json in Resources */, @@ -879,6 +895,7 @@ buildActionMask = 2147483647; files = ( 628B95292670CABE0091AF3B /* Assets.xcassets in Resources */, + 53AFFDEB26A2520800261FD0 /* Localizable.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1151,6 +1168,18 @@ }; /* End PBXTargetDependency section */ +/* Begin PBXVariantGroup section */ + 53AFFDE726A2520800261FD0 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 53AFFDE826A2520800261FD0 /* en */, + 53AFFDEC26A2523300261FD0 /* es */, + ); + name = Localizable.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 535870722669D21700D05A09 /* Debug */ = { isa = XCBuildConfiguration; @@ -1161,7 +1190,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = "JellyfinPlayer tvOS/JellyfinPlayer tvOS.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 56; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_ASSET_PATHS = "\"JellyfinPlayer tvOS/Preview Content\""; DEVELOPMENT_TEAM = 9R8RREG67J; ENABLE_PREVIEWS = YES; @@ -1176,9 +1205,10 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; + SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 14.5; + TVOS_DEPLOYMENT_TARGET = 14.1; }; name = Debug; }; @@ -1191,7 +1221,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = "JellyfinPlayer tvOS/JellyfinPlayer tvOS.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 56; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_ASSET_PATHS = "\"JellyfinPlayer tvOS/Preview Content\""; DEVELOPMENT_TEAM = 9R8RREG67J; ENABLE_PREVIEWS = YES; @@ -1205,9 +1235,10 @@ PRODUCT_BUNDLE_IDENTIFIER = me.vigue.jellyfin; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; + SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 14.5; + TVOS_DEPLOYMENT_TARGET = 14.1; }; name = Release; }; @@ -1215,6 +1246,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -1278,6 +1310,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -1340,7 +1373,7 @@ CODE_SIGN_ENTITLEMENTS = JellyfinPlayer/JellyfinPlayer.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 56; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = 9R8RREG67J; ENABLE_BITCODE = NO; @@ -1360,6 +1393,7 @@ SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; + SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -1375,7 +1409,7 @@ CODE_SIGN_ENTITLEMENTS = JellyfinPlayer/JellyfinPlayer.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 56; + CURRENT_PROJECT_VERSION = 57; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = 9R8RREG67J; @@ -1395,6 +1429,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -1407,7 +1442,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = WidgetExtension/WidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 56; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_TEAM = 9R8RREG67J; INFOPLIST_FILE = WidgetExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.1; @@ -1421,6 +1456,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; + SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -1433,7 +1469,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = WidgetExtension/WidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 56; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_TEAM = 9R8RREG67J; INFOPLIST_FILE = WidgetExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.1; @@ -1446,6 +1482,7 @@ PRODUCT_BUNDLE_IDENTIFIER = me.vigue.jellyfin.widget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/JellyfinPlayer/Components/PortraitItemView.swift b/JellyfinPlayer/Components/PortraitItemView.swift index fcc261a2..13942a3b 100644 --- a/JellyfinPlayer/Components/PortraitItemView.swift +++ b/JellyfinPlayer/Components/PortraitItemView.swift @@ -18,7 +18,8 @@ struct PortraitItemView: View { ImageView(src: item.type != "Episode" ? item.getPrimaryImage(maxWidth: 100) : item.getSeriesPrimaryImage(maxWidth: 100), bh: item.type != "Episode" ? item.getPrimaryImageBlurHash() : item.getSeriesPrimaryImageBlurHash()) .frame(width: 100, height: 150) .cornerRadius(10) - .shadow(radius: 4) + .shadow(radius: 4, y: 2) + .shadow(radius: 4, y: 2) .overlay( Rectangle() .fill(Color(red: 172/255, green: 92/255, blue: 195/255)) @@ -43,20 +44,23 @@ struct PortraitItemView: View { .overlay( ZStack { if item.userData?.played ?? false { - Image(systemName: "circle.fill") - .foregroundColor(.white) Image(systemName: "checkmark.circle.fill") - .foregroundColor(Color(.systemBlue)) + .foregroundColor(.accentColor) + .background(Color(.white)) + .cornerRadius(.infinity) } else { if item.userData?.unplayedItemCount != nil { - Image(systemName: "circle.fill") - .foregroundColor(Color(.systemBlue)) + Capsule() + .fill(Color.accentColor) + .frame(minWidth: 20, minHeight: 20, maxHeight: 20) Text(String(item.userData!.unplayedItemCount ?? 0)) .foregroundColor(.white) .font(.caption2) + .padding(2) } } }.padding(2) + .fixedSize() .opacity(1), alignment: .topTrailing).opacity(1) Text(item.seriesName ?? item.name ?? "") .font(.caption) diff --git a/JellyfinPlayer/ConnectToServerView.swift b/JellyfinPlayer/ConnectToServerView.swift index e1ffd7cf..589dcdb0 100644 --- a/JellyfinPlayer/ConnectToServerView.swift +++ b/JellyfinPlayer/ConnectToServerView.swift @@ -19,10 +19,10 @@ struct ConnectToServerView: View { if viewModel.isConnectedServer { if viewModel.publicUsers.isEmpty { Section(header: Text("Login to \(ServerEnvironment.current.server.name ?? "")")) { - TextField("Username", text: $username) + TextField(NSLocalizedString("Username", comment: ""), text: $username) .disableAutocorrection(true) .autocapitalization(.none) - SecureField("Password", text: $password) + SecureField(NSLocalizedString("Password", comment: ""), text: $password) .disableAutocorrection(true) .autocapitalization(.none) Button { @@ -106,7 +106,7 @@ struct ConnectToServerView: View { } } else { Section(header: Text("Connect Manually")) { - TextField("Server URL", text: $uri) + TextField(NSLocalizedString("Server URL", comment: ""), text: $uri) .disableAutocorrection(true) .autocapitalization(.none) Button { @@ -162,6 +162,6 @@ struct ConnectToServerView: View { .alert(item: $viewModel.errorMessage) { _ in Alert(title: Text("Error"), message: Text($viewModel.errorMessage.wrappedValue!), dismissButton: .default(Text("Try again"))) } - .navigationTitle("Connect to Server") + .navigationTitle(NSLocalizedString("Connect to Server", comment: "")) } } diff --git a/JellyfinPlayer/ContinueWatchingView.swift b/JellyfinPlayer/ContinueWatchingView.swift index 19845f26..390f7aa3 100644 --- a/JellyfinPlayer/ContinueWatchingView.swift +++ b/JellyfinPlayer/ContinueWatchingView.swift @@ -42,7 +42,8 @@ struct ContinueWatchingView: View { ImageView(src: item.getBackdropImage(maxWidth: 320), bh: item.getBackdropImageBlurHash()) .frame(width: 320, height: 180) .cornerRadius(10) - .shadow(radius: 4) + .shadow(radius: 4, y: 2) + .shadow(radius: 4, y: 2) .overlay( Rectangle() .fill(Color(red: 172/255, green: 92/255, blue: 195/255)) diff --git a/JellyfinPlayer/HomeView.swift b/JellyfinPlayer/HomeView.swift index 7c3767e9..72e282ac 100644 --- a/JellyfinPlayer/HomeView.swift +++ b/JellyfinPlayer/HomeView.swift @@ -56,7 +56,7 @@ struct HomeView: View { var body: some View { innerBody - .navigationTitle(MainTabView.Tab.home.localized) + .navigationTitle(NSLocalizedString("Home", comment: "")) .toolbar { ToolbarItemGroup(placement: .navigationBarTrailing) { Button { diff --git a/JellyfinPlayer/LibraryFilterView.swift b/JellyfinPlayer/LibraryFilterView.swift index 1ec19458..8c01231f 100644 --- a/JellyfinPlayer/LibraryFilterView.swift +++ b/JellyfinPlayer/LibraryFilterView.swift @@ -29,19 +29,19 @@ struct LibraryFilterView: View { } else { Form { if viewModel.enabledFilterType.contains(.genre) { - MultiSelector(label: "Genres", + MultiSelector(label: NSLocalizedString("Genres", comment: ""), options: viewModel.possibleGenres, optionToString: { $0.name ?? "" }, selected: $viewModel.modifiedFilters.withGenres) } if viewModel.enabledFilterType.contains(.filter) { - MultiSelector(label: "Filters", + MultiSelector(label: NSLocalizedString("Filters", comment: ""), options: viewModel.possibleItemFilters, optionToString: { $0.localized }, selected: $viewModel.modifiedFilters.filters) } if viewModel.enabledFilterType.contains(.tag) { - MultiSelector(label: "Tags", + MultiSelector(label: NSLocalizedString("Tags", comment: ""), options: viewModel.possibleTags, optionToString: { $0 }, selected: $viewModel.modifiedFilters.tags) @@ -70,7 +70,7 @@ struct LibraryFilterView: View { } } } - .navigationBarTitle("Filter Results", displayMode: .inline) + .navigationBarTitle(NSLocalizedString("Filter Results", comment: ""), displayMode: .inline) .toolbar { ToolbarItemGroup(placement: .navigationBarLeading) { Button { diff --git a/JellyfinPlayer/LibraryListView.swift b/JellyfinPlayer/LibraryListView.swift index 7aa41109..059cd1de 100644 --- a/JellyfinPlayer/LibraryListView.swift +++ b/JellyfinPlayer/LibraryListView.swift @@ -93,7 +93,7 @@ struct LibraryListView: View { .padding(.trailing, 16) .padding(.top, 8) } - .navigationTitle("All Media") + .navigationTitle(NSLocalizedString("All Media", comment: "")) .toolbar { ToolbarItemGroup(placement: .navigationBarTrailing) { NavigationLink(destination: LazyView { diff --git a/JellyfinPlayer/MainTabView.swift b/JellyfinPlayer/MainTabView.swift index 4736e946..fabf9b8c 100644 --- a/JellyfinPlayer/MainTabView.swift +++ b/JellyfinPlayer/MainTabView.swift @@ -20,7 +20,7 @@ struct MainTabView: View { } .navigationViewStyle(StackNavigationViewStyle()) .tabItem { - Text(Tab.home.localized) + Text("Home") Image(systemName: "house") } .tag(Tab.home) @@ -29,7 +29,7 @@ struct MainTabView: View { } .navigationViewStyle(StackNavigationViewStyle()) .tabItem { - Text(Tab.allMedia.localized) + Text("All Media") Image(systemName: "folder") } .tag(Tab.allMedia) @@ -42,14 +42,5 @@ extension MainTabView { enum Tab: String { case home case allMedia - - var localized: String { - switch self { - case .home: - return "Home" - case .allMedia: - return "All Media" - } - } } } diff --git a/JellyfinPlayer/SearchBarView.swift b/JellyfinPlayer/SearchBarView.swift index 44286628..892027fc 100644 --- a/JellyfinPlayer/SearchBarView.swift +++ b/JellyfinPlayer/SearchBarView.swift @@ -16,7 +16,7 @@ struct SearchBar: View { var body: some View { HStack(spacing: 8) { - TextField("Search...", text: $text) + TextField(NSLocalizedString("Search...", comment: ""), text: $text) .padding(8) .padding(.horizontal, 16) .background(Color(.systemGray6)) diff --git a/JellyfinPlayer/SettingsView.swift b/JellyfinPlayer/SettingsView.swift index 719514d3..dbd8a425 100644 --- a/JellyfinPlayer/SettingsView.swift +++ b/JellyfinPlayer/SettingsView.swift @@ -70,10 +70,8 @@ struct SettingsView: View { Button { let nc = NotificationCenter.default nc.post(name: Notification.Name("didSignOut"), object: nil) - - SessionManager.current.logout() } label: { - Text("Log out").font(.callout) + Text("Switch user").font(.callout) } } } diff --git a/JellyfinPlayer/VideoPlayerCastDeviceSelector.swift b/JellyfinPlayer/VideoPlayerCastDeviceSelector.swift index 5608b1a4..ac784125 100644 --- a/JellyfinPlayer/VideoPlayerCastDeviceSelector.swift +++ b/JellyfinPlayer/VideoPlayerCastDeviceSelector.swift @@ -73,7 +73,7 @@ struct VideoPlayerCastDeviceSelector: View { } } .navigationBarTitleDisplayMode(.inline) - .navigationTitle("Select Cast Destination") + .navigationTitle(NSLocalizedString("Select Cast Destination", comment: "")) .toolbar { ToolbarItemGroup(placement: .navigationBarLeading) { if UIDevice.current.userInterfaceIdiom == .phone { diff --git a/JellyfinPlayer/VideoPlayerSettingsView.swift b/JellyfinPlayer/VideoPlayerSettingsView.swift index a6aab3fb..c4715020 100644 --- a/JellyfinPlayer/VideoPlayerSettingsView.swift +++ b/JellyfinPlayer/VideoPlayerSettingsView.swift @@ -46,7 +46,7 @@ struct VideoPlayerSettings: View { var body: some View { NavigationView { Form { - Picker("Closed Captions", selection: $captionTrack) { + Picker(NSLocalizedString("Closed Captions", comment: ""), selection: $captionTrack) { ForEach(delegate.subtitleTrackArray, id: \.id) { caption in Text(caption.name).tag(caption.id) } @@ -54,28 +54,24 @@ struct VideoPlayerSettings: View { .onChange(of: captionTrack) { track in self.delegate.subtitleTrackChanged(newTrackID: track) } - Picker("Audio Track", selection: $audioTrack) { + Picker(NSLocalizedString("Audio Track", comment: ""), selection: $audioTrack) { ForEach(delegate.audioTrackArray, id: \.id) { caption in Text(caption.name).tag(caption.id).lineLimit(1) } }.onChange(of: audioTrack) { track in self.delegate.audioTrackChanged(newTrackID: track) } - Picker("Playback Speed", selection: $playbackSpeedSelection) { + Picker(NSLocalizedString("Playback Speed", comment: ""), selection: $playbackSpeedSelection) { ForEach(delegate.playbackSpeeds.indices, id: \.self) { speedIndex in let speed = delegate.playbackSpeeds[speedIndex] - if floor(speed) == speed { - Text(String(format: "%.0fx", speed)).tag(speedIndex) - } else { - Text(String(format: "%.2fx", speed)).tag(speedIndex) - } + Text("\(String(speed))x").tag(speedIndex) } } .onChange(of: playbackSpeedSelection, perform: { index in self.delegate.playbackSpeedChanged(index: index) }) }.navigationBarTitleDisplayMode(.inline) - .navigationTitle("Audio & Captions") + .navigationTitle(NSLocalizedString("Audio & Captions", comment: "")) .toolbar { ToolbarItemGroup(placement: .navigationBarLeading) { if UIDevice.current.userInterfaceIdiom == .phone {