Localization on Ionic
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.
iOS
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.xcframework/ios-arm64/DocumentReader.framework/en.lproj/RegulaSDK.strings
.
Danger
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.
For more information on localizing your application and best practices, please refer to the official Apple documentation.
Android
To do this, simply add the needed strings to strings.xml
file.
The values.xml
file with all available strings can be found in the project: External Libraries -> Gradle: com.regula.documentreader:api:X.X.X@aar -> values -> values
.xml
For more information on localizing your application and best practices, please see the official Android documentation.
Example
You can implement it by using the config.xml
:
- Android:
Add strings desired to localize:
<platform name="android">
<config-file parent="/*" target="res/values/strings.xml">
<string name="strLookingDocument">Hello, world</string>
</config-file>
</platform>
- iOS:
Create the RegulaSDK.strings
file in the resources
folder, and add strings desired to localize:
<platform name="ios">
<resource-file src="resources/RegulaSDK.strings" target="RegulaSDK.strings" />
</platform>
Content of the RegulaSDK.strings
file:
"strLookingDocument" = "Hello, world";