Localization
Supported Languages
Document Reader SDK supports the following languages:
- Arabic (ar)
- Bangla (bn)
- Czech (cs)
- Danish (da)
- German (de)
- Greek (el)
- English (en)
- Spanish (es)
- Finnish (fi)
- French (fr)
- Hebrew (he)
- Hindi (hi)
- Croatian (hr)
- Hungarian (hu)
- Indonesian (id)
- Italian (it)
- Japanese (ja)
- Korean (ko)
- Malay (ms)
- Norwegian (nb)
- Dutch (nl)
- Polish (pl)
- Portuguese (pt)
- Romanian (ro)
- Russian (ru)
- Slovak (sk)
- Swedish (sv)
- Thai (th)
- Turkish (tr)
- Ukrainian (uk)
- Vietnamese (vi)
- Chinese Simplified (zh-Hans)
- Chinese Traditional (zh-Hant)
Customizing Localization
Document Reader SDK supports localization using standard iOS System Settings. If a language is required by your application but is not supported by the SDK, or you want to change our localized strings, you can add localized strings to the additional resource files and allow the SDK to be presented to users in their required system locale.
To get started, include the string resource file named RegulaSDK.strings
, which is provided with the latest SDK release version, to your project's Resources folder. This file name is required, and customization will work only if it is set as specified.
Next, navigate to Project Settings → Info and add the needed languages in the Localizations section.
Warning
Don't forget to include RegulaSDK.strings
as a Resource File.
Now you can replace every string in the SDK with appropriate translated values. Thus, when a user sets the device's System Language to a language supported by your application, the SDK utilizes the appropriate string resources.
You can find the RegulaSDK.strings
file with all the available strings here: Project-name/Pods/DocumentReader/DocumentReader.framework/en.lproj/RegulaSDK.strings
or download it right here.
If Document Reader SDK is added inside another SDK where strings are modified, don't forget to add the following line of code, otherwise, strings won't be changed:
DocReader.shared.localizationClassName = self.classForCoder
[RGLDocReader shared].localizationClassName = self.classForCoder;
Info
For more information on localizing your application and best practices, please refer to the official Apple documentation.
Warning
Avoid changing the iOS system language (by using the AppleLanguages pref key) from within your application. This goes against the basic iOS user model for switching languages in the Settings app and uses a preference key that is not documented. At some point in the future, the key name may change and that would break your application.
Changing the app's language programmatically
Users can choose any language that the app supports in the "Preferred language" section of the app in "Settings" if it isn't supported by the iOS system. You can navigate them via the app to this section (you can have a look at the example of how we did implement this in our app that is available on App Store: Menu -> Settings -> Advanced -> Language
).
As Apple mentioned:
Quote
Changing language in code is not supported. Launch to Settings if you need to add a language option within your app: UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)
.
If you wish to allow users to change the app's language right in the app, you can apply the following code snippet to your code (changing to Spanish is demonstrated there using UserDefaults
):
UserDefaults.standard.set(["es"], forKey: "AppleLanguages")
UserDefaults.standard.synchronize()