CocoaPods trunk is moving to be read-only. Read more on the blog, there are 16 months to go.

Localized 1.0.1

Localized 1.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Nov 2016
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Willow Alexandra.



Localized 1.0.1

Localized

A prettier way to localize strings in Swift.

Usage

Just call .localized() or .localize(with: <arguments>) on a string. Literally.

let ❤️ = "about.nameLabel.text".localize(with: "Willow Alexandra")
print(heart) // My name is Willow Alexandra.

No more of this:

let localized = NSLocalized("about.nameLabel.text", comment: "")
let 😭 = String(format: localized, arguments: "Willow Alexandra")
print(crying_face) // My name is Willow Alexandra.

Acknowledgements

I recently attended CocoaHeads Berlin where @MatejBalantic talked about things he learned while building a cross-platform app in Swift. At one point in this talk, he mentioned a better way to localize strings and referenced his String+Localized.swift gist. I have been using this in all of my projects since that talk and wanted to make it easier to integrate. There are a few minor improvements too.

License

Localized is released and distributed under the MIT License.