Localization
The PhotoEditor SDK is fully localizable. We provide an English fallback localization, that will be used when no matching localization is found. To determine the matching language, PhotoEditor SDK uses NSLocale.preferredLanguages
.
To add support for a language, please refer to Apple's localization guidelines.
We also provide two properties to customize your localization, PESDK.localizationDictionary
and PESDK.localizationBlock
.
Localization Dictionary#
The first method to add another language is to set PESDK.localizationDictionary
to a dictionary containing your localizations. The key of the dictionary needs to be the locale that you want to add, the value should be another dictionary containing the string that needs to be localized as the key and the localized version as the value. An example for the German language might look like this:
PESDK.localizationDictionary = ["de": ["No permission": "Keine Berechtigung","Top left cropping area": "Zuschneidebereich oben links","Settings": "Einstellungen"]]
Localization Closure#
The more advanced way to add localization is passing a closure, which will be called for each string that can be localized. You can then use that closure to look up a matching localization in your app's Localizable.strings
file or do something completely custom. An example might look like this:
PESDK.localizationBlock = { stringToLocalize inreturn NSLocalizedString(stringToLocalize, comment: "")}
Localizable.strings#
A list of strings that are used in the SDK is available within the framework's bundle at PhotoEditorSDK.framework/PhotoEditorSDK.bundle/en.lproj/Localizable.strings
. The contents of that file are in binary format. To convert them back into a readable format please use the following command:
plutil -convert xml1 PhotoEditorSDK.framework/PhotoEditorSDK.bundle/en.lproj/Localizable.strings