Swiftpack.co - octree/Localization as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by octree.
octree/Localization 1.0.4
[iOS] In-app language changing library with reactive api
⭐️ 4
🕓 33 weeks ago
iOS macCatalyst
.package(url: "https://github.com/octree/Localization.git", from: "1.0.4")

Localization

SPM

Localization is a framework for in-app language changes, providing reactive API so that the app can be translated in real time.

Example

Basic

label.l10n.text.bind(.pure("Hello"))
languageButton.l10n.title(for: .normal).bind(key: "Language")

Operations

let localizer = Localizer.pure("Part 1")
    .combine(.pure("Part 2"))
    .map { $0 + " " + $1 }
    .map { NSAttributedString(string: $0, attributes: [.foregroundColor: UIColor.systemPink]) }
label.l10n.attributedText.bind(localizer)

Requirements

  • iOS 13.0+
  • Swift 5.0+

Installation

Swift Package Manager

Author

Octree, [email protected]

License

Localization is available under the MIT license. See the LICENSE file for more info.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics