TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Nov 2017 |
SwiftSwift Version | 4.0 |
SPMSupports SPM | ✗ |
Maintained by Tom Wolters.
TWLocalize written in Swift makes iOS localizations easy. No longer do you need to localize your app, keep multiple .string files and use NSLocalizedString.
The framework uses a dictionary to retrieve the desired strings. Simply add your own TWLocalizedText dictionary with all the desired translated strings.
struct MyStrings {
static let MyText:TWLocalizedText = [.english: "This is my text", .dutch: "Dit is mijn tekst"]
}
let label = UILabel()
label.setLocalized(text: MyStrings.MyText)
or use the localized property of MyText directly.
label.text = Strings.MyText.localized
TWLocalize makes use of the current locale language. It's possible to change the language.
TWLocalize.setLanguage(to: .dutch)
Reset the custom set language
TWLocalize.setLanguage(to: nil)
TWLocalize is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "TWLocalize"
Tom Wolters, https://twitter.com/tom_wolters
TWLocalize is available under the MIT license. See the LICENSE file for more info.