CombineLocalizer
CombineLocalizer is a framework written in swift which allows you to localize your apps, using Combine.
Requirements
- Xcode 11+
- Swift 5+
- iOS 13+
Installation
Swift Package Manager (requires Xcode 11)
Add package into Project settings -> Swift Packages
CocoaPods
pod 'CombineLocalizer'
Usage
Before all:
import CombineLocalizer
Reactive localized strings
Localizer.shared.localized("Start")
.map { $0 }
.assign(to: \.text, on: startLabel)
.store(in: &cancellableBag)
Synchronously localized strings
startLabel.text = Localizer.shared.localized("Start")
Change language
You are able to set language by language code. A full list of the codes you can check here.
Localizer.shared.changeLanguage.accept("en")
Change CombineLocalizer configuration
You are able to change default configuration, using changeConfiguration
property.
let localizerConfig = LocalizerConfig(defaults: .standard, bundle: .main, tableName: "Localizable")
Localizer.shared.changeConfiguration.send(localizerConfig)
License
CombineLocalizer is available under the MIT license. See the LICENSE file for more info. Copyright (c) Vlad Khambir