diff --git a/RevenueCatUI/Data/PaywallData+Validation.swift b/RevenueCatUI/Data/PaywallData+Validation.swift index 3f8fceec71..1ffb794e69 100644 --- a/RevenueCatUI/Data/PaywallData+Validation.swift +++ b/RevenueCatUI/Data/PaywallData+Validation.swift @@ -11,6 +11,8 @@ // // Created by Nacho Soto on 8/15/23. +import Foundation + import RevenueCat // MARK: - Errors @@ -39,7 +41,7 @@ extension Offering { extension Offering { /// - Returns: a validated paywall suitable to be displayed, and any associated error. - func validatedPaywall() -> ValidationResult { + func validatedPaywall(locale: Locale = .current) -> ValidationResult { if let paywall = self.paywall { switch paywall.validate() { case let .success(template): @@ -48,13 +50,13 @@ extension Offering { case let .failure(error): // If there are any errors, create a default paywall // with only the configured packages. - return (.createDefault(with: paywall.config.packages), + return (.createDefault(with: paywall.config.packages, locale: locale), PaywallData.defaultTemplate, error) } } else { // If `Offering` has no paywall, create a default one with all available packages. - return (displayablePaywall: .createDefault(with: self.availablePackages), + return (displayablePaywall: .createDefault(with: self.availablePackages, locale: locale), PaywallData.defaultTemplate, error: .missingPaywall) } diff --git a/RevenueCatUI/Helpers/PaywallData+Default.swift b/RevenueCatUI/Helpers/PaywallData+Default.swift index 88dd417825..f89e89f9b8 100644 --- a/RevenueCatUI/Helpers/PaywallData+Default.swift +++ b/RevenueCatUI/Helpers/PaywallData+Default.swift @@ -22,11 +22,17 @@ extension PaywallData { /// Default `PaywallData` to display when attempting to present a ``PaywallView`` with an offering /// that has no paywall configuration, or when that configuration is invalid. - static func createDefault(with packages: [Package]) -> Self { - return self.createDefault(with: packages.map(\.identifier)) + static func createDefault( + with packages: [Package], + locale: Locale + ) -> Self { + return self.createDefault(with: packages.map(\.identifier), locale: locale) } - static func createDefault(with packageIdentifiers: [String]) -> Self { + static func createDefault( + with packageIdentifiers: [String], + locale: Locale + ) -> Self { return .init( templateName: Self.defaultTemplate.rawValue, config: .init( @@ -39,7 +45,7 @@ extension PaywallData { blurredBackgroundImage: true, displayRestorePurchases: true ), - localization: Self.localization, + localization: Self.localization(Localization.localizedBundle(locale)), assetBaseURL: Self.defaultTemplateBaseURL, revision: Self.revisionID ) @@ -90,13 +96,21 @@ private extension PaywallData { )) }() - static let localization: PaywallData.LocalizedConfiguration = .init( - title: "{{ app_name }}", - subtitle: nil, - callToAction: "Continue", - offerDetails: "{{ total_price_and_per_month }}", - offerDetailsWithIntroOffer: "Start your {{ sub_offer_duration }} trial, then {{ total_price_and_per_month }}." - ) + static func localization(_ localizedBundle: Bundle) -> PaywallData.LocalizedConfiguration { + .init( + title: "{{ app_name }}", + subtitle: nil, + callToAction: localizedBundle + .localizedString(forKey: "Continue", value: nil, table: nil), + offerDetails: "{{ total_price_and_per_month }}", + offerDetailsWithIntroOffer: localizedBundle + .localizedString( + forKey: "Default_offer_details_with_intro_offer", + value: "Start your {{ sub_offer_duration }} trial, then {{ total_price_and_per_month }}.", + table: nil + ) + ) + } static let backgroundImage = "background.jpg" static let defaultTemplateBaseURL = Bundle.module.resourceURL ?? Bundle.module.bundleURL @@ -124,11 +138,14 @@ struct DefaultPaywall_Previews: PreviewProvider { identifier: "offering", serverDescription: "Main offering", metadata: [:], - paywall: .createDefault(with: [ - TestData.weeklyPackage, - TestData.monthlyPackage, - TestData.annualPackage - ]), + paywall: .createDefault( + with: [ + TestData.weeklyPackage, + TestData.monthlyPackage, + TestData.annualPackage + ], + locale: .current + ), availablePackages: TestData.packages ) diff --git a/RevenueCatUI/PaywallView.swift b/RevenueCatUI/PaywallView.swift index 54fc6fb454..b4c450f858 100644 --- a/RevenueCatUI/PaywallView.swift +++ b/RevenueCatUI/PaywallView.swift @@ -27,6 +27,9 @@ public struct PaywallView: View { private let mode: PaywallViewMode private let fonts: PaywallFontProvider + @Environment(\.locale) + private var locale + @StateObject private var purchaseHandler: PurchaseHandler @@ -150,7 +153,7 @@ public struct PaywallView: View { checker: TrialOrIntroEligibilityChecker, purchaseHandler: PurchaseHandler ) -> some View { - let (paywall, template, error) = offering.validatedPaywall() + let (paywall, template, error) = offering.validatedPaywall(locale: self.locale) let paywallView = LoadedOfferingPaywallView( offering: offering, diff --git a/RevenueCatUI/Resources/ar.lproj/Localizable.strings b/RevenueCatUI/Resources/ar.lproj/Localizable.strings index 0acc3b0fe0..7ddd7d398c 100644 --- a/RevenueCatUI/Resources/ar.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/ar.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "أسبوعي"; "Lifetime" = "حياة"; "%d%% off" = "خصم %d%%"; +"Continue" = "يكمل"; +"Default_offer_details_with_intro_offer" = "ابدأ الفترة التجريبية التي تبلغ {{ sub_offer_duration }}، ثم {{ Total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/bg.lproj/Localizable.strings b/RevenueCatUI/Resources/bg.lproj/Localizable.strings index d6d2a1d9d2..e183cd4469 100644 --- a/RevenueCatUI/Resources/bg.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/bg.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Ежеседмично"; "Lifetime" = "Живот"; "%d%% off" = "%d%% намаление"; +"Continue" = "продължи"; +"Default_offer_details_with_intro_offer" = "Започнете своя пробен период от {{ sub_offer_duration }}, след което {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/ca.lproj/Localizable.strings b/RevenueCatUI/Resources/ca.lproj/Localizable.strings index c8e7f1503a..00d6f32863 100644 --- a/RevenueCatUI/Resources/ca.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/ca.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Setmanalment"; "Lifetime" = "Tota una vida"; "%d%% off" = "%d%% de descompte"; +"Continue" = "Continua"; +"Default_offer_details_with_intro_offer" = "Inicieu la vostra prova de {{ sub_offer_duration }} i després {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/cs.lproj/Localizable.strings b/RevenueCatUI/Resources/cs.lproj/Localizable.strings index 7b0eab72d4..fcbcab37a0 100644 --- a/RevenueCatUI/Resources/cs.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/cs.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Týdně"; "Lifetime" = "Život"; "%d%% off" = "%d%% sleva"; +"Continue" = "Pokračovat"; +"Default_offer_details_with_intro_offer" = "Začněte {{ sub_offer_duration }} zkušební období, poté {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/da.lproj/Localizable.strings b/RevenueCatUI/Resources/da.lproj/Localizable.strings index e03bf15989..4e07b88b70 100644 --- a/RevenueCatUI/Resources/da.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/da.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Ugentlig"; "Lifetime" = "Livstid"; "%d%% off" = "%d%% rabat"; +"Continue" = "Blive ved"; +"Default_offer_details_with_intro_offer" = "Start din prøveperiode på {{ sub_offer_duration }} og derefter {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/de.lproj/Localizable.strings b/RevenueCatUI/Resources/de.lproj/Localizable.strings index 5bcd8f5955..9ce0ac2862 100644 --- a/RevenueCatUI/Resources/de.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/de.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Wöchentlich"; "Lifetime" = "Lebensdauer"; "%d%% off" = "%d %% Rabatt"; +"Continue" = "Weitermachen"; +"Default_offer_details_with_intro_offer" = "Starten Sie Ihre Testversion für {{ sub_offer_duration }} und dann für {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/el.lproj/Localizable.strings b/RevenueCatUI/Resources/el.lproj/Localizable.strings index 5f6760b9b3..15ce45eca1 100644 --- a/RevenueCatUI/Resources/el.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/el.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Εβδομαδιαίος"; "Lifetime" = "Διάρκεια Ζωής"; "%d%% off" = "Έκπτωση %d%%"; +"Continue" = "Να συνεχίσει"; +"Default_offer_details_with_intro_offer" = "Ξεκινήστε τη δοκιμή {{ sub_offer_duration }} και μετά {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/en.lproj/Localizable.strings b/RevenueCatUI/Resources/en.lproj/Localizable.strings index 079ac27f56..eb59e1d760 100644 --- a/RevenueCatUI/Resources/en.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/en.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Weekly"; "Lifetime" = "Lifetime"; "%d%% off" = "%d%% off"; +"Continue" = "Continue"; +"Default_offer_details_with_intro_offer" = "Start your {{ sub_offer_duration }} trial, then {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/en_AU.lproj/Localizable.strings b/RevenueCatUI/Resources/en_AU.lproj/Localizable.strings index 079ac27f56..eb59e1d760 100644 --- a/RevenueCatUI/Resources/en_AU.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/en_AU.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Weekly"; "Lifetime" = "Lifetime"; "%d%% off" = "%d%% off"; +"Continue" = "Continue"; +"Default_offer_details_with_intro_offer" = "Start your {{ sub_offer_duration }} trial, then {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/en_CA.lproj/Localizable.strings b/RevenueCatUI/Resources/en_CA.lproj/Localizable.strings index 079ac27f56..eb59e1d760 100644 --- a/RevenueCatUI/Resources/en_CA.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/en_CA.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Weekly"; "Lifetime" = "Lifetime"; "%d%% off" = "%d%% off"; +"Continue" = "Continue"; +"Default_offer_details_with_intro_offer" = "Start your {{ sub_offer_duration }} trial, then {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/en_GB.lproj/Localizable.strings b/RevenueCatUI/Resources/en_GB.lproj/Localizable.strings index 079ac27f56..eb59e1d760 100644 --- a/RevenueCatUI/Resources/en_GB.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/en_GB.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Weekly"; "Lifetime" = "Lifetime"; "%d%% off" = "%d%% off"; +"Continue" = "Continue"; +"Default_offer_details_with_intro_offer" = "Start your {{ sub_offer_duration }} trial, then {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/en_US.lproj/Localizable.strings b/RevenueCatUI/Resources/en_US.lproj/Localizable.strings index 079ac27f56..eb59e1d760 100644 --- a/RevenueCatUI/Resources/en_US.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/en_US.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Weekly"; "Lifetime" = "Lifetime"; "%d%% off" = "%d%% off"; +"Continue" = "Continue"; +"Default_offer_details_with_intro_offer" = "Start your {{ sub_offer_duration }} trial, then {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/es_419.lproj/Localizable.strings b/RevenueCatUI/Resources/es_419.lproj/Localizable.strings index 58e9e42a92..2c9ca91959 100644 --- a/RevenueCatUI/Resources/es_419.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/es_419.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Semanalmente"; "Lifetime" = "Toda la vida"; "%d%% off" = "%d%% de descuento"; +"Continue" = "Continuar"; +"Default_offer_details_with_intro_offer" = "{{ sub_offer_duration }} gratis y luego {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/es_ES.lproj/Localizable.strings b/RevenueCatUI/Resources/es_ES.lproj/Localizable.strings index 58e9e42a92..2c9ca91959 100644 --- a/RevenueCatUI/Resources/es_ES.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/es_ES.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Semanalmente"; "Lifetime" = "Toda la vida"; "%d%% off" = "%d%% de descuento"; +"Continue" = "Continuar"; +"Default_offer_details_with_intro_offer" = "{{ sub_offer_duration }} gratis y luego {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/fi.lproj/Localizable.strings b/RevenueCatUI/Resources/fi.lproj/Localizable.strings index 1312aab4e2..34a481ddfa 100644 --- a/RevenueCatUI/Resources/fi.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/fi.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Viikoittain"; "Lifetime" = "Elinikä"; "%d%% off" = "%d%% alennus"; +"Continue" = "Jatkaa"; +"Default_offer_details_with_intro_offer" = "Aloita {{ sub_offer_duration }} -kokeilu ja sitten {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/fr_CA.lproj/Localizable.strings b/RevenueCatUI/Resources/fr_CA.lproj/Localizable.strings index d896158685..6f8eae7788 100644 --- a/RevenueCatUI/Resources/fr_CA.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/fr_CA.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Hebdomadaire"; "Lifetime" = "Durée de vie"; "%d%% off" = "%d%% de réduction"; +"Continue" = "Continuer"; +"Default_offer_details_with_intro_offer" = "Démarrez votre essai de {{ sub_offer_duration }}, puis de {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/he.lproj/Localizable.strings b/RevenueCatUI/Resources/he.lproj/Localizable.strings index a81c1be5d9..a97feaed24 100644 --- a/RevenueCatUI/Resources/he.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/he.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "שְׁבוּעִי"; "Lifetime" = "לכל החיים"; "%d%% off" = "%d%% הנחה"; +"Continue" = "לְהַמשִׁיך"; +"Default_offer_details_with_intro_offer" = "התחל את תקופת הניסיון של {{ sub_offer_duration }} ולאחר מכן {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/hi.lproj/Localizable.strings b/RevenueCatUI/Resources/hi.lproj/Localizable.strings index 91496f387a..8b3bba8128 100644 --- a/RevenueCatUI/Resources/hi.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/hi.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "साप्ताहिक"; "Lifetime" = "जीवनभर"; "%d%% off" = "%d%% छूट"; +"Continue" = "जारी रखना"; +"Default_offer_details_with_intro_offer" = "अपना {{sub_offer_duration }} परीक्षण शुरू करें, फिर {{ total_price_and_per_month }}।"; diff --git a/RevenueCatUI/Resources/hr.lproj/Localizable.strings b/RevenueCatUI/Resources/hr.lproj/Localizable.strings index 486eddcd94..8d37873729 100644 --- a/RevenueCatUI/Resources/hr.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/hr.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Tjedni"; "Lifetime" = "Doživotno"; "%d%% off" = "%d%% popusta"; +"Continue" = "Nastaviti"; +"Default_offer_details_with_intro_offer" = "Započnite probno razdoblje od {{ sub_offer_duration }}, a zatim {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/hu.lproj/Localizable.strings b/RevenueCatUI/Resources/hu.lproj/Localizable.strings index 4cb4c31b86..fc343de4e8 100644 --- a/RevenueCatUI/Resources/hu.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/hu.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Heti"; "Lifetime" = "Élettartam"; "%d%% off" = "%d%% kedvezménnyel"; +"Continue" = "Folytatni"; +"Default_offer_details_with_intro_offer" = "Indítsa el a {{ sub_offer_duration }} próbaidőszakot, majd {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/id.lproj/Localizable.strings b/RevenueCatUI/Resources/id.lproj/Localizable.strings index c66c51b387..a4266461fb 100644 --- a/RevenueCatUI/Resources/id.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/id.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Mingguan"; "Lifetime" = "Seumur hidup"; "%d%% off" = "Diskon %d%%"; +"Continue" = "Melanjutkan"; +"Default_offer_details_with_intro_offer" = "Mulai uji coba {{ sub_offer_duration }} Anda, lalu {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/it.lproj/Localizable.strings b/RevenueCatUI/Resources/it.lproj/Localizable.strings index 3772124acc..bd6468493c 100644 --- a/RevenueCatUI/Resources/it.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/it.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "settimanalmente"; "Lifetime" = "Tutta la vita"; "%d%% off" = "Sconto del %d%%"; +"Continue" = "Continua"; +"Default_offer_details_with_intro_offer" = "Inizia la tua prova di {{ sub_offer_duration }}, poi {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/ja.lproj/Localizable.strings b/RevenueCatUI/Resources/ja.lproj/Localizable.strings index 7a73c255e5..e46e85d2de 100644 --- a/RevenueCatUI/Resources/ja.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/ja.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "毎週"; "Lifetime" = "一生"; "%d%% off" = "%d%%オフ"; +"Continue" = "続く"; +"Default_offer_details_with_intro_offer" = "{{ sub_offer_duration }} トライアルを開始してから、{{ total_price_and_per_month }} を開始してください。"; diff --git a/RevenueCatUI/Resources/kk.lproj/Localizable.strings b/RevenueCatUI/Resources/kk.lproj/Localizable.strings index fe6c9455a0..929cbb8a36 100644 --- a/RevenueCatUI/Resources/kk.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/kk.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Апта сайын"; "Lifetime" = "Өмір кезеңі"; "%d%% off" = "%d%% жеңілдік"; +"Continue" = "Жалғастыру"; +"Default_offer_details_with_intro_offer" = "{{ sub_offer_duration }} сынақ нұсқасын бастаңыз, содан кейін {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/ko.lproj/Localizable.strings b/RevenueCatUI/Resources/ko.lproj/Localizable.strings index 0315502724..260cb459c6 100644 --- a/RevenueCatUI/Resources/ko.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/ko.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "주간"; "Lifetime" = "일생"; "%d%% off" = "%d%% 할인"; +"Continue" = "계속하다"; +"Default_offer_details_with_intro_offer" = "{{ sub_offer_duration }} 무료 체험을 시작한 후 {{ total_price_and_per_month }}를 시작하세요."; diff --git a/RevenueCatUI/Resources/ms.lproj/Localizable.strings b/RevenueCatUI/Resources/ms.lproj/Localizable.strings index 00ca5cda5d..6f0a649d51 100644 --- a/RevenueCatUI/Resources/ms.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/ms.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Setiap minggu"; "Lifetime" = "Seumur hidup"; "%d%% off" = "%d%% diskaun"; +"Continue" = "teruskan"; +"Default_offer_details_with_intro_offer" = "Mulakan percubaan {{ sub_offer_duration }} anda, kemudian {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/nl.lproj/Localizable.strings b/RevenueCatUI/Resources/nl.lproj/Localizable.strings index 3af0dd99a3..ff07a4a949 100644 --- a/RevenueCatUI/Resources/nl.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/nl.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Wekelijks"; "Lifetime" = "Levenslang"; "%d%% off" = "%d%% korting"; +"Continue" = "Doorgaan"; +"Default_offer_details_with_intro_offer" = "Start uw proefperiode van {{ sub_offer_duration }} en daarna {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/no.lproj/Localizable.strings b/RevenueCatUI/Resources/no.lproj/Localizable.strings index 7276382313..13829d1651 100644 --- a/RevenueCatUI/Resources/no.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/no.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Ukentlig"; "Lifetime" = "Livstid"; "%d%% off" = "%d %% rabatt"; +"Continue" = "Fortsette"; +"Default_offer_details_with_intro_offer" = "Start prøveperioden på {{ sub_offer_duration }}, og deretter {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/pl.lproj/Localizable.strings b/RevenueCatUI/Resources/pl.lproj/Localizable.strings index 137e56a94a..461fe99396 100644 --- a/RevenueCatUI/Resources/pl.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/pl.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Co tydzień"; "Lifetime" = "Dożywotni"; "%d%% off" = "%d%% zniżki"; +"Continue" = "Kontynuować"; +"Default_offer_details_with_intro_offer" = "Rozpocznij okres próbny {{ sub_offer_duration }}, a następnie {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/pt_BR.lproj/Localizable.strings b/RevenueCatUI/Resources/pt_BR.lproj/Localizable.strings index a9267c0f1a..f8a7659782 100644 --- a/RevenueCatUI/Resources/pt_BR.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/pt_BR.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Semanalmente"; "Lifetime" = "Vida"; "%d%% off" = "%d%% de desconto"; +"Continue" = "Continuar"; +"Default_offer_details_with_intro_offer" = "Comece sua avaliação de {{ sub_offer_duration }} e depois {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/pt_PT.lproj/Localizable.strings b/RevenueCatUI/Resources/pt_PT.lproj/Localizable.strings index a9267c0f1a..f8a7659782 100644 --- a/RevenueCatUI/Resources/pt_PT.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/pt_PT.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Semanalmente"; "Lifetime" = "Vida"; "%d%% off" = "%d%% de desconto"; +"Continue" = "Continuar"; +"Default_offer_details_with_intro_offer" = "Comece sua avaliação de {{ sub_offer_duration }} e depois {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/ro.lproj/Localizable.strings b/RevenueCatUI/Resources/ro.lproj/Localizable.strings index f9cf0bea91..388db64136 100644 --- a/RevenueCatUI/Resources/ro.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/ro.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Săptămânal"; "Lifetime" = "Durata de viață"; "%d%% off" = "%d%% reducere"; +"Continue" = "Continua"; +"Default_offer_details_with_intro_offer" = "Începeți perioada de încercare de {{ sub_offer_duration }}, apoi {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/ru.lproj/Localizable.strings b/RevenueCatUI/Resources/ru.lproj/Localizable.strings index ffc0021d78..7e087008f8 100644 --- a/RevenueCatUI/Resources/ru.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/ru.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Еженедельно"; "Lifetime" = "Продолжительность жизни"; "%d%% off" = "Скидка %d%%"; +"Continue" = "Продолжать"; +"Default_offer_details_with_intro_offer" = "Начните пробную версию {{ sub_offer_duration }}, затем {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/sk.lproj/Localizable.strings b/RevenueCatUI/Resources/sk.lproj/Localizable.strings index 2ce7c7f4c1..c7c425b637 100644 --- a/RevenueCatUI/Resources/sk.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/sk.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Týždenne"; "Lifetime" = "Život"; "%d%% off" = "%d%% zľava"; +"Continue" = "ďalej"; +"Default_offer_details_with_intro_offer" = "Začnite skúšobnú verziu {{ sub_offer_duration }}, potom {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/sv.lproj/Localizable.strings b/RevenueCatUI/Resources/sv.lproj/Localizable.strings index 8886eeaa2b..5bba07a997 100644 --- a/RevenueCatUI/Resources/sv.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/sv.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Varje vecka"; "Lifetime" = "Livstid"; "%d%% off" = "%d%% rabatt"; +"Continue" = "Fortsätta"; +"Default_offer_details_with_intro_offer" = "Starta din provperiod på {{ sub_offer_duration }} och sedan {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/th.lproj/Localizable.strings b/RevenueCatUI/Resources/th.lproj/Localizable.strings index e6a98bf189..cc06ac750c 100644 --- a/RevenueCatUI/Resources/th.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/th.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "รายสัปดาห์"; "Lifetime" = "อายุการใช้งาน"; "%d%% off" = "ลด %d%%"; +"Continue" = "ดำเนินการต่อ"; +"Default_offer_details_with_intro_offer" = "เริ่มทดลองใช้ {{ sub_offer_duration }} จากนั้นจ่ายเป็น {{ Total_price_and_per_month }}"; diff --git a/RevenueCatUI/Resources/tr.lproj/Localizable.strings b/RevenueCatUI/Resources/tr.lproj/Localizable.strings index 4841b285df..cfbd7b4538 100644 --- a/RevenueCatUI/Resources/tr.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/tr.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Haftalık"; "Lifetime" = "Ömür"; "%d%% off" = "%%d%% indirim"; +"Continue" = "Devam etmek"; +"Default_offer_details_with_intro_offer" = "{{ sub_offer_duration }} denemenizi başlatın, ardından {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/uk.lproj/Localizable.strings b/RevenueCatUI/Resources/uk.lproj/Localizable.strings index ec2120754b..86dcbe5b97 100644 --- a/RevenueCatUI/Resources/uk.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/uk.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "Щотижня"; "Lifetime" = "Час життя"; "%d%% off" = "Знижка %d%%"; +"Continue" = "Продовжити"; +"Default_offer_details_with_intro_offer" = "Розпочніть {{ sub_offer_duration }} пробний період, а потім {{ total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/vi.lproj/Localizable.strings b/RevenueCatUI/Resources/vi.lproj/Localizable.strings index aaaf8ca298..f2c71cb8ec 100644 --- a/RevenueCatUI/Resources/vi.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/vi.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "hàng tuần"; "Lifetime" = "Cả đời"; "%d%% off" = "giảm giá %d%%"; +"Continue" = "Tiếp tục"; +"Default_offer_details_with_intro_offer" = "Bắt đầu dùng thử {{ sub_offer_duration }}, sau đó là {{ Total_price_and_per_month }}."; diff --git a/RevenueCatUI/Resources/zh-Hans.lproj/Localizable.strings b/RevenueCatUI/Resources/zh-Hans.lproj/Localizable.strings index 1e1e97f5cc..5753eed2f3 100644 --- a/RevenueCatUI/Resources/zh-Hans.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/zh-Hans.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "每周"; "Lifetime" = "寿命"; "%d%% off" = "%d%%折"; +"Continue" = "继续"; +"Default_offer_details_with_intro_offer" = "开始 {{ sub_offer_duration }} 试用,然后 {{total_price_and_per_month }}。"; diff --git a/RevenueCatUI/Resources/zh_HK.lproj/Localizable.strings b/RevenueCatUI/Resources/zh_HK.lproj/Localizable.strings index 1433d9e560..955f6a6e94 100644 --- a/RevenueCatUI/Resources/zh_HK.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/zh_HK.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "每週"; "Lifetime" = "壽命"; "%d%% off" = "%d%%折"; +"Continue" = "繼續"; +"Default_offer_details_with_intro_offer" = "開始 {{ sub_offer_duration }} 試用,然後 {{total_price_and_per_month }}。"; diff --git a/RevenueCatUI/Resources/zh_TW.lproj/Localizable.strings b/RevenueCatUI/Resources/zh_TW.lproj/Localizable.strings index 1433d9e560..955f6a6e94 100644 --- a/RevenueCatUI/Resources/zh_TW.lproj/Localizable.strings +++ b/RevenueCatUI/Resources/zh_TW.lproj/Localizable.strings @@ -15,3 +15,5 @@ "Weekly" = "每週"; "Lifetime" = "壽命"; "%d%% off" = "%d%%折"; +"Continue" = "繼續"; +"Default_offer_details_with_intro_offer" = "開始 {{ sub_offer_duration }} 試用,然後 {{total_price_and_per_month }}。"; diff --git a/RevenueCatUI/Views/LoadingPaywallView.swift b/RevenueCatUI/Views/LoadingPaywallView.swift index 5e2624ab04..8e8213ad54 100644 --- a/RevenueCatUI/Views/LoadingPaywallView.swift +++ b/RevenueCatUI/Views/LoadingPaywallView.swift @@ -54,7 +54,7 @@ struct LoadingPaywallView: View { } private static let template: PaywallTemplate = PaywallData.defaultTemplate - private static let defaultPaywall: PaywallData = .createDefault(with: Self.packages) + private static let defaultPaywall: PaywallData = .createDefault(with: Self.packages, locale: .current) private static let paywall: PaywallData = { var paywall: PaywallData = Self.defaultPaywall diff --git a/Tests/RevenueCatUITests/Data/PaywallDataValidationTests.swift b/Tests/RevenueCatUITests/Data/PaywallDataValidationTests.swift index 2233282cdc..b687dd1b06 100644 --- a/Tests/RevenueCatUITests/Data/PaywallDataValidationTests.swift +++ b/Tests/RevenueCatUITests/Data/PaywallDataValidationTests.swift @@ -30,6 +30,16 @@ class PaywallDataValidationTests: TestCase { expect(result.error) == .missingPaywall } + func testValidateMissingPaywallWithSpanishLocalization() { + let offering = TestData.offeringWithNoPaywall + let result = TestData.offeringWithNoPaywall.validatedPaywall(locale: .init(identifier: "es_ES")) + + Self.verifyPackages(in: result.displayablePaywall, match: offering.availablePackages) + Self.snapshot(result.displayablePaywall) + + expect(result.error) == .missingPaywall + } + func testValidateValidPaywall() { let offering = TestData.offeringWithSinglePackageFeaturesPaywall let result = offering.validatedPaywall() diff --git a/Tests/RevenueCatUITests/Data/__Snapshots__/PaywallDataValidationTests/testValidateMissingPaywallWithSpanishLocalization.1.json b/Tests/RevenueCatUITests/Data/__Snapshots__/PaywallDataValidationTests/testValidateMissingPaywallWithSpanishLocalization.1.json new file mode 100644 index 0000000000..8dd47dea94 --- /dev/null +++ b/Tests/RevenueCatUITests/Data/__Snapshots__/PaywallDataValidationTests/testValidateMissingPaywallWithSpanishLocalization.1.json @@ -0,0 +1,44 @@ +{ + "asset_base_url" : "https://assets.pawwalls.com", + "config" : { + "blurred_background_image" : true, + "colors" : { + "light" : { + "accent1" : "#FFFFFF", + "accent2" : "#FFFFFF", + "background" : "#FFFFFF", + "call_to_action_background" : "#FFFFFF", + "call_to_action_foreground" : "#FFFFFF", + "text1" : "#FFFFFF" + } + }, + "display_restore_purchases" : true, + "images" : { + "background" : "background.jpg", + "header" : null, + "icon" : "revenuecatui_default_paywall_app_icon" + }, + "packages" : [ + "$rc_monthly", + "$rc_annual" + ], + "privacy_url" : null, + "tos_url" : null + }, + "localized_strings" : { + "en_US" : { + "call_to_action" : "Continuar", + "call_to_action_with_intro_offer" : null, + "features" : [ + + ], + "offer_details" : "{{ total_price_and_per_month }}", + "offer_details_with_intro_offer" : "{{ sub_offer_duration }} gratis y luego {{ total_price_and_per_month }}.", + "offer_name" : null, + "subtitle" : null, + "title" : "{{ app_name }}" + } + }, + "revision" : -1, + "template_name" : "2" +} \ No newline at end of file diff --git a/Tests/RevenueCatUITests/Templates/OtherPaywallViewTests.swift b/Tests/RevenueCatUITests/Templates/OtherPaywallViewTests.swift index 07b978dc4b..8a5d09a94b 100644 --- a/Tests/RevenueCatUITests/Templates/OtherPaywallViewTests.swift +++ b/Tests/RevenueCatUITests/Templates/OtherPaywallViewTests.swift @@ -20,6 +20,12 @@ class OtherPaywallViewTests: BaseSnapshotTest { .snapshot(size: Self.fullScreenSize) } + func testDefaultSpanishPaywall() { + Self.createPaywall(offering: TestData.offeringWithNoPaywall) + .environment(\.locale, .init(identifier: "es_ES")) + .snapshot(size: Self.fullScreenSize) + } + func testDefaultDarkModePaywall() { Self.createPaywall(offering: TestData.offeringWithNoPaywall) .environment(\.colorScheme, .dark) diff --git a/Tests/purchases-ios-snapshots-commit b/Tests/purchases-ios-snapshots-commit index c17e393129..e7b64fd920 100644 --- a/Tests/purchases-ios-snapshots-commit +++ b/Tests/purchases-ios-snapshots-commit @@ -1 +1 @@ -627ee603d03498c89b8b3feec2a6d0b23c079c91 +891367b83ddc536d9513aa51b7a7de57ded3a175