dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.74k stars 633 forks source link

Does the react-native-iap support localised title? #2458

Open cervebar opened 1 year ago

cervebar commented 1 year ago

Description

We have localized iap products (very likely) correctly defined in Google Play and in App Store. In code we are using change language feature (via i18n) is there anyhow possible to retrieve localised title/name of products?

Expected someting like:

const products = await getProducts({skus: productIds})
const locTitle = products[0].localisedTitle

Environment:

To Reproduce

const products = await getProducts({skus: productIds})
console.log(products)

professorkolik commented 1 year ago

As far as I can say it will take languages which are set to user AppStore/PlayStore

Based on docs Product contains

title => Returns the title Android and localizedTitle on iOS. description => Returns the localized description on Android and iOS.

If you wanna show based on user settings localization, then you should handle it on your end

MTPL0005-AbhishekDube commented 10 months ago

Yes, it returns the localized price for iOS and Android, but the key that produces the localized price differs. for iOS --> sub.localizedPrice will give the localized price, for Android --> sub.subscriptionOfferDetails[0].pricingPhases.pricingPhaseList[0].formattedPrice

here "sub" stores the data returned by IAP.getSubscriptions