Fix localization issues

This commit is contained in:
2024-04-25 09:25:50 -04:00
parent be585e914d
commit e0b1985df5
60 changed files with 495 additions and 385 deletions

View File

@@ -31,9 +31,10 @@ struct DamusPurpleAccountView: View {
// TODO: Generalize this view instead of setting up dividers and paddings manually
VStack {
HStack {
Text(NSLocalizedString("Expiry date", comment: "Label for Purple subscription expiry date"))
Text("Expiry date", comment: "Label for Purple subscription expiry date")
Spacer()
Text(DateFormatter.localizedString(from: account.expiry, dateStyle: .short, timeStyle: .none))
let formattedDate = DateFormatter.localizedString(from: account.expiry, dateStyle: .short, timeStyle: .none)
Text(formattedDate)
}
.padding(.horizontal)
.padding(.top, 20)
@@ -43,9 +44,10 @@ struct DamusPurpleAccountView: View {
.padding(.vertical, 10)
HStack {
Text(NSLocalizedString("Account creation", comment: "Label for Purple account creation date"))
Text("Account creation", comment: "Label for Purple account creation date")
Spacer()
Text(DateFormatter.localizedString(from: account.created_at, dateStyle: .short, timeStyle: .none))
let formattedDate = DateFormatter.localizedString(from: account.created_at, dateStyle: .short, timeStyle: .none)
Text(formattedDate)
}
.padding(.horizontal)
@@ -54,7 +56,7 @@ struct DamusPurpleAccountView: View {
.padding(.vertical, 10)
HStack {
Text(NSLocalizedString("Subscriber number", comment: "Label for Purple account subscriber number"))
Text("Subscriber number", comment: "Label for Purple account subscriber number")
Spacer()
Text(verbatim: "#\(account.subscriber_number)")
}
@@ -90,7 +92,7 @@ struct DamusPurpleAccountView: View {
.resizable()
.frame(width: 15, height: 15)
Text(NSLocalizedString("Active account", comment: "Badge indicating user has an active Damus Purple account"))
Text("Active account", comment: "Badge indicating user has an active Damus Purple account")
.font(.caption)
.bold()
}
@@ -107,7 +109,7 @@ struct DamusPurpleAccountView: View {
.resizable()
.frame(width: 15, height: 15)
Text(NSLocalizedString("Expired account", comment: "Badge indicating user has an expired Damus Purple account"))
Text("Expired account", comment: "Badge indicating user has an expired Damus Purple account")
.font(.caption)
.bold()
}

View File

@@ -61,7 +61,7 @@ struct DamusPurpleTranslationSetupView: View {
.opacity(start ? 1.0 : 0.0)
.animation(.content(), value: start)
Text(NSLocalizedString("You unlocked", comment: "Part 1 of 2 in message 'You unlocked automatic translations' the user gets when they sign up for Damus Purple" ))
Text("You unlocked", comment: "Part 1 of 2 in message 'You unlocked automatic translations' the user gets when they sign up for Damus Purple" )
.font(.largeTitle)
.fontWeight(.bold)
.foregroundStyle(
@@ -95,7 +95,7 @@ struct DamusPurpleTranslationSetupView: View {
.opacity(start ? 1.0 : 0.0)
.animation(Animation.snappy(duration: 2).delay(0), value: start)
Text(NSLocalizedString("Automatic translations", comment: "Part 1 of 2 in message 'You unlocked automatic translations' the user gets when they sign up for Damus Purple"))
Text("Automatic translations", comment: "Part 1 of 2 in message 'You unlocked automatic translations' the user gets when they sign up for Damus Purple")
.font(.headline)
.fontWeight(.bold)
.foregroundStyle(
@@ -110,7 +110,7 @@ struct DamusPurpleTranslationSetupView: View {
.animation(.content(), value: start)
.padding(.top, 10)
Text(NSLocalizedString("As part of your Damus Purple membership, you get complimentary and automated translations. Would you like to enable Damus Purple translations?\n\nTip: You can always change this later in Settings → Translations", comment: "Message notifying the user that they get auto-translations as part of their service"))
Text("As part of your Damus Purple membership, you get complimentary and automated translations. Would you like to enable Damus Purple translations?\n\nTip: You can always change this later in Settings → Translations", comment: "Message notifying the user that they get auto-translations as part of their service")
.lineSpacing(5)
.multilineTextAlignment(.center)
.foregroundStyle(.white.opacity(0.8))
@@ -125,7 +125,7 @@ struct DamusPurpleTranslationSetupView: View {
}, label: {
HStack {
Spacer()
Text(NSLocalizedString("Enable Purple auto-translations", comment: "Label for button that allows users to enable Damus Purple translations"))
Text("Enable Purple auto-translations", comment: "Label for button that allows users to enable Damus Purple translations")
Spacer()
}
})
@@ -139,7 +139,7 @@ struct DamusPurpleTranslationSetupView: View {
}, label: {
HStack {
Spacer()
Text(NSLocalizedString("No, thanks", comment: "Label for button that allows users to reject enabling Damus Purple translations"))
Text("No, thanks", comment: "Label for button that allows users to reject enabling Damus Purple translations")
Spacer()
}
})

View File

@@ -53,7 +53,7 @@ struct DamusPurpleVerifyNpubView: View {
}, label: {
HStack {
Spacer()
Text(NSLocalizedString("Verify my npub", comment: "Button label to verify the user's npub for the purpose of Purple subscription checkout"))
Text("Verify my npub", comment: "Button label to verify the user's npub for the purpose of Purple subscription checkout")
Spacer()
}
})
@@ -61,7 +61,7 @@ struct DamusPurpleVerifyNpubView: View {
.buttonStyle(GradientButtonStyle())
}
else {
Text(NSLocalizedString("Verified!", comment: "Instructions after the user has verified their npub for Damus Purple purchase checkout"))
Text("Verified!", comment: "Instructions after the user has verified their npub for Damus Purple purchase checkout")
.frame(height: subtitle_height)
.multilineTextAlignment(.center)
.foregroundColor(.green)
@@ -71,7 +71,7 @@ struct DamusPurpleVerifyNpubView: View {
}, label: {
HStack {
Spacer()
Text(NSLocalizedString("Continue", comment: "Prompt to user to continue"))
Text("Continue", comment: "Prompt to user to continue")
Spacer()
}
})

View File

@@ -138,7 +138,7 @@ struct DamusPurpleView: View, DamusPurpleStoreKitManagerDelegate {
if let account_uuid {
DamusPurpleView.IAPProductStateView(products: products, purchased: purchased, account_uuid: account_uuid, subscribe: subscribe)
if let iap_error {
Text(String(format: NSLocalizedString("There has been an unexpected error with the in-app purchase. Please try again later or contact support@damus.io. Error: %@", comment: "In-app purchase error message for the user"), iap_error))
Text("There has been an unexpected error with the in-app purchase. Please try again later or contact support@damus.io. Error: \(iap_error)", comment: "In-app purchase error message for the user")
.foregroundStyle(.red)
.multilineTextAlignment(.center)
.padding(.horizontal)
@@ -158,7 +158,7 @@ struct DamusPurpleView: View, DamusPurpleStoreKitManagerDelegate {
}
var ManageOnWebsiteNote: some View {
Text(NSLocalizedString("Visit the Damus website on a web browser to manage billing", comment: "Instruction on how to manage billing externally"))
Text("Visit the Damus website on a web browser to manage billing", comment: "Instruction on how to manage billing externally")
.font(.caption)
.foregroundColor(.white.opacity(0.6))
.multilineTextAlignment(.center)

View File

@@ -37,7 +37,7 @@ struct DamusPurpleWelcomeView: View {
.opacity(start ? 1.0 : 0.0)
.animation(.content(), value: start)
Text(NSLocalizedString("Welcome to Purple", comment: "Greeting to subscription service"))
Text("Welcome to Purple", comment: "Greeting to subscription service")
.font(.largeTitle)
.fontWeight(.bold)
.foregroundStyle(
@@ -70,7 +70,7 @@ struct DamusPurpleWelcomeView: View {
.opacity(start ? 1.0 : 0.0)
.animation(Animation.snappy(duration: 2).delay(0), value: start)
Text(NSLocalizedString("Thank you very much for signing up for Damus\u{00A0}Purple. Your contribution helps us continue our fight for a more Open and Free\u{00A0}internet.\n\nYou will also get access to premium features, and a star badge on your profile.\n\nEnjoy!", comment: "Appreciation to user for purchasing subscription service"))
Text("Thank you very much for signing up for Damus\u{00A0}Purple. Your contribution helps us continue our fight for a more Open and Free\u{00A0}internet.\n\nYou will also get access to premium features, and a star badge on your profile.\n\nEnjoy!", comment: "Appreciation to user for purchasing subscription service")
.lineSpacing(5)
.multilineTextAlignment(.center)
.foregroundStyle(.white.opacity(0.8))
@@ -85,7 +85,7 @@ struct DamusPurpleWelcomeView: View {
}, label: {
HStack {
Spacer()
Text(NSLocalizedString("Continue", comment: "Prompt to user to continue"))
Text("Continue", comment: "Prompt to user to continue")
Spacer()
}
})

View File

@@ -26,7 +26,7 @@ extension DamusPurpleView {
var body: some View {
if subscription_purchase_loading {
HStack(spacing: 10) {
Text(NSLocalizedString("Purchasing", comment: "Loading label indicating the purchase action is in progress"))
Text("Purchasing", comment: "Loading label indicating the purchase action is in progress")
.foregroundStyle(.white)
ProgressView()
.progressViewStyle(.circular)
@@ -66,7 +66,7 @@ extension DamusPurpleView {
}
func PurchasedUnmanageableView(_ purchased: PurchasedProduct) -> some View {
Text(NSLocalizedString("This device's in-app purchase is registered to a different Nostr account. Unable to manage this Purple account. If you believe this was a mistake, please contact us via support@damus.io.", comment: "Notice label that user cannot manage their In-App purchases"))
Text("This device's in-app purchase is registered to a different Nostr account. Unable to manage this Purple account. If you believe this was a mistake, please contact us via support@damus.io.", comment: "Notice label that user cannot manage their In-App purchases")
.font(.caption)
.foregroundColor(.white.opacity(0.6))
.multilineTextAlignment(.center)
@@ -76,21 +76,21 @@ extension DamusPurpleView {
func PurchasedManageView(_ purchased: PurchasedProduct) -> some View {
VStack(spacing: 10) {
if SHOW_IAP_DEBUG_INFO == true {
Text(NSLocalizedString("Purchased!", comment: "User purchased a subscription"))
Text("Purchased!", comment: "User purchased a subscription")
.font(.title2)
.foregroundColor(.white)
price_description(product: purchased.product)
.foregroundColor(.white)
.opacity(0.65)
.frame(width: 200)
Text(NSLocalizedString("Purchased on", comment: "Indicating when the user purchased the subscription"))
Text("Purchased on", comment: "Indicating when the user purchased the subscription")
.font(.title2)
.foregroundColor(.white)
Text(format_date(date: purchased.tx.purchaseDate))
.foregroundColor(.white)
.opacity(0.65)
if let expiry = purchased.tx.expirationDate {
Text(NSLocalizedString("Renews on", comment: "Indicating when the subscription will renew"))
Text("Renews on", comment: "Indicating when the subscription will renew")
.font(.title2)
.foregroundColor(.white)
Text(format_date(date: expiry))
@@ -101,7 +101,7 @@ extension DamusPurpleView {
Button(action: {
show_manage_subscriptions = true
}, label: {
Text(NSLocalizedString("Manage", comment: "Manage the damus subscription"))
Text("Manage", comment: "Manage the damus subscription")
.padding(.horizontal, 20)
})
.buttonStyle(GradientButtonStyle())
@@ -112,7 +112,7 @@ extension DamusPurpleView {
func ProductsView(_ products: [Product]) -> some View {
VStack(spacing: 10) {
Text(NSLocalizedString("Save 20% off on an annual subscription", comment: "Savings for purchasing an annual subscription"))
Text("Save 20% off on an annual subscription", comment: "Savings for purchasing an annual subscription")
.font(.callout.bold())
.foregroundColor(.white)
ForEach(products) { product in
@@ -132,7 +132,7 @@ extension DamusPurpleView {
.buttonStyle(GradientButtonStyle())
}
Text("By subscribing to Damus Purple you are accepting our [privacy policy](https://damus.io/privacy-policy.txt) and Apple's Standard [EULA](https://www.apple.com/legal/internet-services/itunes/dev/stdeula/)")
Text("By subscribing to Damus Purple, you are accepting our [privacy policy](https://damus.io/privacy-policy.txt) and Apple's Standard [EULA](https://www.apple.com/legal/internet-services/itunes/dev/stdeula/)", comment: "Text explaining the terms and conditions of subscribing to Damus Purple. EULA stands for End User License Agreement.")
.foregroundColor(.white.opacity(0.6))
.font(.caption)
.padding()
@@ -148,11 +148,11 @@ extension DamusPurpleView {
Text(purple_type?.label() ?? product.displayName)
Spacer()
if let non_discounted_price = purple_type?.non_discounted_price(product: product) {
Text(verbatim: non_discounted_price)
Text(non_discounted_price)
.strikethrough()
.foregroundColor(DamusColors.white.opacity(0.5))
}
Text(verbatim: product.displayPrice)
Text(product.displayPrice)
.fontWeight(.bold)
}
)

View File

@@ -27,7 +27,7 @@ extension DamusPurpleView {
.shadow(radius: 5)
VStack(alignment: .leading) {
Text(NSLocalizedString("Purple", comment: "Subscription service name"))
Text("Purple", comment: "Subscription service name")
.font(.system(size: 60.0).weight(.bold))
.foregroundStyle(
LinearGradient(

View File

@@ -38,7 +38,7 @@ extension DamusPurpleView {
.resizable()
.frame(width: 15, height: 15)
Text(NSLocalizedString("Coming soon", comment: "Feature is still in development and will be available soon"))
Text("Coming soon", comment: "Feature is still in development and will be available soon")
.font(.caption)
.bold()
}

View File

@@ -25,6 +25,6 @@ struct PurpleBackdrop<T: View>: View {
#Preview {
PurpleBackdrop {
Text("Hello, World")
Text(verbatim: "Hello, World")
}
}

View File

@@ -67,14 +67,14 @@ struct PurpleViewPrimitives {
struct ProductLoadErrorView: View {
var body: some View {
Text(NSLocalizedString("Subscription Error", comment: "Ah dang there was an error loading subscription information from the AppStore. Please try again later :("))
Text("Subscription Error", comment: "Ah dang there was an error loading subscription information from the AppStore. Please try again later :(")
.foregroundColor(.white)
}
}
struct SaveTextView: View {
var body: some View {
Text(NSLocalizedString("Save 14%", comment: "Percentage of purchase price the user will save"))
Text("Save 14%", comment: "Percentage of purchase price the user will save")
.font(.callout)
.italic()
.foregroundColor(DamusColors.green)