square/in-app-payments-ios

Localization

dibelogrivaya opened this issue · 3 comments

Hi! Is there any way of overriding the SDK language? Thanks.

Hi @dibelogrivaya what do you mean by overriding the SDK language? In-App Payments supports multiple languages and as long as the device is set to a language that the SDK supports it will automatically use that language.

Hi again! I mean setting the language on the fly. It would be nice to have an option to show screens in the specified language (if it is supported by SDK). This is necessary, for example, if you make it possible to authorize different users on one device with the ability to set the interface language for each (after authorization there is no need to switch the interface language in the application settings, everything is immediately displayed in the language specified for this user).

Unfortunately there isn't anything for this supported in the SDK. You could do something like setting a value of the language you want in UserDefaults using the key AppleLanguages but this will still require an app restart for the language to update. But you won't have to go and change the device language in settings.

UserDefaults.standard.set(["fr"], forKey: "AppleLanguages")
/// restart app
/// Next app launch the SDK should now be in "fr"