Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localize all (most) current strings #282

Merged
merged 4 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Shared/Coordinators/LiveTVTabCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class LiveTVTabCoordinator: TabCoordinatable {
func makeProgramsTab(isActive: Bool) -> some View {
HStack {
Image(systemName: "tv")
Text("Programs")
L10n.programs.text
}
}

Expand All @@ -44,7 +44,7 @@ final class LiveTVTabCoordinator: TabCoordinatable {
func makeChannelsTab(isActive: Bool) -> some View {
HStack {
Image(systemName: "square.grid.3x3")
Text("Channels")
L10n.channels.text
}
}

Expand All @@ -56,7 +56,7 @@ final class LiveTVTabCoordinator: TabCoordinatable {
func makeHomeTab(isActive: Bool) -> some View {
HStack {
Image(systemName: "house")
Text("Home")
L10n.home.text
}
}
}
10 changes: 5 additions & 5 deletions Shared/Coordinators/MainCoordinator/tvOSMainTabCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,26 @@ final class MainTabCoordinator: TabCoordinatable {
}

func makeTv() -> NavigationViewCoordinator<TVLibrariesCoordinator> {
NavigationViewCoordinator(TVLibrariesCoordinator(viewModel: TVLibrariesViewModel(), title: "TV Shows"))
NavigationViewCoordinator(TVLibrariesCoordinator(viewModel: TVLibrariesViewModel(), title: L10n.tvShows))
}

@ViewBuilder
func makeTvTab(isActive: Bool) -> some View {
HStack {
Image(systemName: "tv")
Text("TV Shows")
L10n.tvShows.text
}
}

func makeMovies() -> NavigationViewCoordinator<MovieLibrariesCoordinator> {
NavigationViewCoordinator(MovieLibrariesCoordinator(viewModel: MovieLibrariesViewModel(), title: "Movies"))
NavigationViewCoordinator(MovieLibrariesCoordinator(viewModel: MovieLibrariesViewModel(), title: L10n.movies))
}

@ViewBuilder
func makeMoviesTab(isActive: Bool) -> some View {
HStack {
Image(systemName: "film")
Text("Movies")
L10n.movies.text
}
}

Expand All @@ -74,7 +74,7 @@ final class MainTabCoordinator: TabCoordinatable {
func makeOtherTab(isActive: Bool) -> some View {
HStack {
Image(systemName: "folder")
Text("Other")
L10n.other.text
}
}

Expand Down
14 changes: 7 additions & 7 deletions Shared/Errors/NetworkError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ enum NetworkError: Error {
{

let errorMessage: ErrorMessage
var logMessage = "An error has occurred."
var logMessage = L10n.unknownError
var logConstructor = logConstructor

switch response {
Expand All @@ -77,14 +77,14 @@ enum NetworkError: Error {
// https://developer.apple.com/documentation/foundation/1508628-url_loading_system_error_codes
switch err._code {
case -1001:
logMessage = "Network timed out."
logMessage = L10n.networkTimedOut
logConstructor.message = logMessage
errorMessage = ErrorMessage(code: err._code,
title: "Timed Out",
title: L10n.error,
displayMessage: displayMessage,
logConstructor: logConstructor)
case -1004:
logMessage = "Cannot connect to host."
logMessage = L10n.cannotConnectToHost
logConstructor.message = logMessage
errorMessage = ErrorMessage(code: err._code,
title: L10n.error,
Expand Down Expand Up @@ -128,7 +128,7 @@ enum NetworkError: Error {
{

let errorMessage: ErrorMessage
var logMessage = "An error has occurred."
var logMessage = L10n.unknownError
var logConstructor = logConstructor

switch response {
Expand All @@ -137,10 +137,10 @@ enum NetworkError: Error {
// Generic HTTP status codes
switch code {
case 401:
logMessage = "User is unauthorized."
logMessage = L10n.unauthorizedUser
logConstructor.message = logMessage
errorMessage = ErrorMessage(code: code,
title: "Unauthorized",
title: L10n.unauthorized,
displayMessage: displayMessage,
logConstructor: logConstructor)
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,15 @@ public extension BaseItemDto {
var informationItems: [ItemDetail] = []

if let productionYear = productionYear {
informationItems.append(ItemDetail(title: "Released", content: "\(productionYear)"))
informationItems.append(ItemDetail(title: L10n.released, content: "\(productionYear)"))
}

if let rating = officialRating {
informationItems.append(ItemDetail(title: "Rated", content: "\(rating)"))
informationItems.append(ItemDetail(title: L10n.rated, content: "\(rating)"))
}

if let runtime = getItemRuntime() {
informationItems.append(ItemDetail(title: "Runtime", content: runtime))
informationItems.append(ItemDetail(title: L10n.runtime, content: runtime))
}

return informationItems
Expand All @@ -267,28 +267,23 @@ public extension BaseItemDto {

if let container = container {
let containerList = container.split(separator: ",").joined(separator: ", ")

if containerList.count > 1 {
mediaItems.append(ItemDetail(title: "Containers", content: containerList))
} else {
mediaItems.append(ItemDetail(title: "Container", content: containerList))
}
mediaItems.append(ItemDetail(title: L10n.containers, content: containerList))
}

if let mediaStreams = mediaStreams {
let audioStreams = mediaStreams.filter { $0.type == .audio }
let subtitleStreams = mediaStreams.filter { $0.type == .subtitle }

if !audioStreams.isEmpty {
let audioList = audioStreams.compactMap { "\($0.displayTitle ?? "No Title") (\($0.codec ?? "No Codec"))" }
let audioList = audioStreams.compactMap { "\($0.displayTitle ?? L10n.noTitle) (\($0.codec ?? L10n.noCodec))" }
.joined(separator: ", ")
mediaItems.append(ItemDetail(title: "Audio", content: audioList))
mediaItems.append(ItemDetail(title: L10n.audio, content: audioList))
}

if !subtitleStreams.isEmpty {
let subtitleList = subtitleStreams.compactMap { "\($0.displayTitle ?? "No Title") (\($0.codec ?? "No Codec"))" }
let subtitleList = subtitleStreams.compactMap { "\($0.displayTitle ?? L10n.noTitle) (\($0.codec ?? L10n.noCodec))" }
.joined(separator: ", ")
mediaItems.append(ItemDetail(title: "Subtitles", content: subtitleList))
mediaItems.append(ItemDetail(title: L10n.subtitles, content: subtitleList))
}
}

Expand Down
Loading