Localized

A prettier way to localize strings.


License
MIT
Install
pod try Localized

Documentation

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.