Hey @aprskavec2,
This feature is now available in the following SDK versions:
- React Native: 9.4.0
- Android: 9.5.0
Below you will find how to implement this for each SDK.
iOS
// During configuration
let builder = Configuration
.builder(withAPIKey: "")
.with(preferredUILocaleOverride: "de_DE")
// At any time as long as the SDK is already configured
// Override locale at runtime; will automatically clear cache when the locale changes
Purchases.shared.overridePreferredUILocale("de_DE")
// Revert to system default
Purchases.shared.overridePreferredUILocale(null);
Android
// During configuration
val configuration = PurchasesConfiguration.Builder(context, apiKey)
.preferredUILocaleOverride("es-ES") // or "es_ES" - both formats supported
.build()
Purchases.configure(configuration)
// Ay any other time as long as the SDK is configured
// Set preferred locale (automatically clears cache if changed)
Purchases.sharedInstance.overridePreferredUILocale("de-DE")
// Revert to system default
Purchases.sharedInstance.overridePreferredUILocale(null)
React Native
// During configuration
Purchases.configure({
apiKey: '<YOUR_API_KEY>',
// other configuration options...
preferredUILocaleOverride: 'es-ES' // both "es-ES" and "es_ES" formats supported
});
// At any time as long as the SDK is configured
// Override locale at runtime; will automatically clear cache when the locale changes
await Purchases.overridePreferredLocale('de-DE');
// Revert to system default
await Purchases.overridePreferredLocale(null);
When the cache gets cleared, offerings will get refetched.
I hope this helps!