TIP: Check out the ios-demo example on Github.
π‘ Shared instance #οΈβ£
To start using the Swift SDK, access singleton instance by:
Localazy.sharedβ¨οΈ Basic usage #οΈβ£
Use String extension to get localized String:
"Hello".localazyLocalizedUse Text (SwiftUI) constructor to get localized String:
Text(localazyKey: "Hello")Enable method swizzling (Beta) to enable Localazy functionality on system methods:
Bundle.swizzleLocalizationWithLocalazy()
NSLocalizedString("Hello", comment: "Hello")NOTE: When using swizzling itβs important to understand that it will replace all calls to
NSLocalizedStringwith the custom logic provided by Localazy SDK and will only fallback to system call if there is no Localazy based translation. For this reason, there may be more logs added to statistics about the missing and used keys.
π Public API #οΈβ£
forceReload: Invalidate internal caches and reload data from servergetString: Get translated StringgetArrayList: Translated ListgetPlural: Translated String with pluralssetEnabled: If Localazy is disabled, translations are obtained by the default system mechanism.getProjectUrl: Project URLgetCurrentLocale: Current system localegetCurrentLocalazyLocale: Current Localazy localeisFullyTranslated: To get information about whether the current internally resolved locale is fully translatedgetLocales: To list all locales known to LocalazyisStatsEnabled: Statistics are enabledsetStatsEnabled: Enable / disable statistics
π Notifications #οΈβ£
We provide several types of notifications which can be produced by the SDK. These notifications are published as a NSNotification objects and can be observed by the NotificationCenter. Some of these notifications can contain a userInfo dictionary to provide more context for you.
The key is not translated into the current language:
localazyMissingTextFounduserInfodictionary:
[
"id": LocalazyID,
"locale": LocalazyLocale,
"key": String
]The library has started the update process:
localazyStringsUpdateStarted
The library has updated the translation data:
localazyStringsUpdateFinished
The data update process failed with an error:
localazyStringsUpdateFaileduserInfodictionary:
[
βerrorβ: Localazy.LocalazyError
]The library contacted the update server and found out that there is no change:
localazyStringsUpdateNotNecessary
The library has loaded data β this is called after initial load, strings update, etc:
localazyStringsLoaded
Resources #οΈβ£
- Check our iOS demo app on Github:


