On my paywall I have a subscribe button that lists the introductory trial period and am trying to make it dynamic so I can A/B test trial period lengths, I have achieved this with string interpolation but can not work out how to localise the periodTitle. Any help would be greatly appreciated.
How does one localise the periodTitle property
Hi! I have the same issue with localization. Wrote about It to support, waiting for answer. moreover, for some reason periodTitle property is not available for me (don’t know, may be because of xCode version, or RevCat version. i get this error: “Value of type 'SubscriptionPeriod' has no member 'periodTitle'” 😕 but i found two other properties of subsctiptionPeriod - value (number) and unit (days, weeks, months etc) and the same - I can’t localize this units because they are of type SubscriptionPeriod.Unit, can’t turn it into String… will write back, if guys from support give me a solution.
Hi Maria, thanks for the reply. I actually just figured it out. I am not sure why periodTitle isn't available to you but here is how I worked out the localisation.
Example for a string in a Text view with German localisation and with string interpolation for your trial length property:
then in your Localizable file:
I hope that helps :)
Happy to hear that you’ve found the solution, that works for you.. But I still can’t even access this periodTitle property 😫 btw, your introDuration that you localize here - (“Start \(NSLocalizedString(introDuration, comment: "intro length")) free trial”) is of the String type?…
Sorry yes my introDuration variable is of type String 😊
Oh gosh I forgot to give you the extension that gives you the periodTitle here it is :)
this is brilliant! Thank you for this extension, now i fixed one of my problems with RevCat 😅 Gooog luck 🤗
Glad you were able to get this solved! Unfortunately we dont have a method that returns a localized string for the periodTitle but I will go ahead and mark that as a feature request!
For future reference, you can see what localized strings we have by searching for `localized` in our SDK reference sheets listed here: https://www.revenuecat.com/docs/reference
Hi Michael oh cool thanks so much 😄