Localizations

This commit is contained in:
Arkadiusz Fal
2022-09-04 17:28:30 +02:00
parent 2d51f6adff
commit b66e177114
33 changed files with 2180 additions and 122 deletions

View File

@@ -42,7 +42,7 @@ struct Instance: Defaults.Serializable, Hashable, Identifiable {
}
var anonymousAccount: Account {
Account(instanceID: id, name: "Anonymous", url: apiURL, anonymous: true)
Account(instanceID: id, name: "Anonymous".localized(), url: apiURL, anonymous: true)
}
var urlComponents: URLComponents {

View File

@@ -10,7 +10,7 @@ final class SearchQuery: ObservableObject {
}
var name: String {
rawValue.capitalized
rawValue.capitalized.localized()
}
}
@@ -22,7 +22,7 @@ final class SearchQuery: ObservableObject {
}
var name: String {
rawValue.capitalized
rawValue.capitalized.localized()
}
}
@@ -36,11 +36,11 @@ final class SearchQuery: ObservableObject {
var name: String {
switch self {
case .uploadDate:
return "Date"
return "Date".localized()
case .viewCount:
return "Views"
return "Views".localized()
default:
return rawValue.capitalized
return rawValue.capitalized.localized()
}
}

View File

@@ -18,12 +18,18 @@ final class SponsorBlockAPI: ObservableObject {
}
switch name {
case "sponsor":
return "Sponsor".localized()
case "selfpromo":
return "Self-promotion"
return "Self-promotion".localized()
case "intro":
return "Intro".localized()
case "outro":
return "Outro".localized()
case "interaction":
return "Interaction".localized()
case "music_offtopic":
return "Offtopic in Music Videos"
return "Offtopic in Music Videos".localized()
default:
return name.capitalized
}
@@ -36,25 +42,25 @@ final class SponsorBlockAPI: ObservableObject {
switch name {
case "sponsor":
return "Part of a video promoting a product or service not directly related to the creator. " +
"The creator will receive payment or compensation in the form of money or free products."
return ("Part of a video promoting a product or service not directly related to the creator. " +
"The creator will receive payment or compensation in the form of money or free products.").localized()
case "selfpromo":
return "Promoting a product or service that is directly related to the creator themselves. " +
"This usually includes merchandise or promotion of monetized platforms."
return ("Promoting a product or service that is directly related to the creator themselves. " +
"This usually includes merchandise or promotion of monetized platforms.").localized()
case "intro":
return "Segments typically found at the start of a video that include an animation, " +
"still frame or clip which are also seen in other videos by the same creator."
return ("Segments typically found at the start of a video that include an animation, " +
"still frame or clip which are also seen in other videos by the same creator.").localized()
case "outro":
return "Typically near or at the end of the video when the credits pop up and/or endcards are shown."
return ("Typically near or at the end of the video when the credits pop up and/or endcards are shown.").localized()
case "interaction":
return "Explicit reminders to like, subscribe or interact with them on any paid or free platform(s) (e.g. click on a video)."
return ("Explicit reminders to like, subscribe or interact with them on any paid or free platform(s) (e.g. click on a video).").localized()
case "music_offtopic":
return "For videos which feature music as the primary content."
return ("For videos which feature music as the primary content.").localized()
default:
return nil

View File

@@ -1,4 +1,5 @@
import Defaults
import Foundation
enum TrendingCategory: String, CaseIterable, Identifiable, Defaults.Serializable {
case `default`, music, gaming, movies
@@ -8,14 +9,23 @@ enum TrendingCategory: String, CaseIterable, Identifiable, Defaults.Serializable
}
var title: RawValue {
rawValue.capitalized
switch self {
case .default:
return "All".localized()
case .music:
return "Music".localized()
case .gaming:
return "Gaming".localized()
case .movies:
return "Movies".localized()
}
}
var name: String {
id == "default" ? "Trending" : title
id == "default" ? "Trending".localized() : title
}
var controlLabel: String {
id == "default" ? "All" : title
id == "default" ? "All".localized() : title
}
}