L10n-swift is a simple framework that improves localization in swift app, providing cleaner syntax and in-app language switching.
Overview
![]() |
![]() |
![]() |
? Features
- [x] Change the language of your apps "on the fly".
- [x] IBInspectable for Xcode Interface Builder (Cocoa - coming soon).
- [x] Support for user-defined
Localizable
file names. - [x] Support for formats:
*.plist
,*.json
,*.stringsdict
,*.strings
. - [x] Support for grouping localization keys.
- [x] Support for plural forms in any language with multiple arguments.
- [x] Support for pseudo-languages:
NonLocalized
,DoubleLength
,Accented
,Bounded
,ForcedRightToLeft
. - [x] Use
.l10n()
to localize any string, date and numbers. - [x] Use more than one language at the same time.
- [x] About 25 times faster than a native solution.
? Demo
⚠️ Requirements
- iOS 9.0+ | macOS 10.10+ | tvOS 9.0+ | watchOS 2.0+
- Swift 3.0+
? Communication
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
? Installation
Core | Extension | IBInspectable | |
---|---|---|---|
L10n-swift | ✔️ | ✔️ | ✔️ |
L10n-swift/Core | ✔️ | ||
L10n-swift/Extension | ✔️ | ✔️ | |
L10n-swift/IBInspectable | ✔️ | ✔️ |
CocoaPods
Carthage
Swift Package Manager
? Usage
Import L10n_swift at the top of each Swift file that will use framework.
Get localized text
Add .l10()
following any String
object you want localized:
Get localized number
Add .l10()
following number you want localized. Using the number format for the current language:
Get localized date
Add .l10()
following any Date
object you want localized using the date format for the current language:
Get plural
Add .l10nPlural(CVarArg...)
following any String
object you want translated with plurals:
More about plurals, you can read on wiki
Observe language changed
Add observer for notification L10nLanguageChanged
. This notification is called when language has been changed.
Set language
At runtime, you can switch the language at any time by setting the language property.
Get current language
Get locale for current language
Get list of supported languages
A list of all the languages contained in the main bundle.
Get preferred language
A preferred language contained in the main bundle.
Supported formats
.plist, .stringsdict

More about .plist format you can read on wiki.
More about .stringsdict format you can read on wiki.
.json

More about .json format you can read on wiki.
.strings

More about .strings format you can read on wiki.
? FAQ
? Author
Adrian Bobrowski (Decybel07), adrian071993@gmail.com
? License
L10n-swift is available under the MIT license. See the LICENSE file for more info.