LocaleComplete
Easily use Locale
in Swift, without needing to deal with String
based identifiers!
How to use
Ever spent time finding the right identifier for the right Locale
language/region?
Ever misspelt a Locale
identifier?
With LocaleComplete, you do not have to deal with that anymore. Simply type what you think would be right, and let the system auto complete it for you.
This library extends Locale
and NSLocale
to allow easier use of Locale
, with code completion support, via two enum
containing all Locale
identifiers.
So you can turn this:
let locale = Locale(identifier: "en_SG")
into this:
let locale = Locale(id: .en_SG)
or this:
let locale = Locale(key: .englishSingapore)
Pretty easy and readable, isn't it?
Inspiration
If you're wondering why I would create this project, here's why:
I always felt that it was a pain to deal with Locale
identifiers. Searching on the web, and there doesn't seem to be a
project like this, which made me develop this.
It's entire concept is inspired by the following great projects:
Do check them out! These are cool and helpful libraries to make development easier.
To install
LocaleComplete
works in all Apple platforms, and supports Swift Package Manager, CocoaPods and Carthage.
By CocoaPods, add the following to your Podfile:
pod 'LocaleComplete'
By Carthage, add the following to your Cartfile:
github "vincentneo/LocaleComplete"
Contributing
Contributions to this project will be more than welcomed. Feel free to add a pull request or open an issue. If you require a feature that has yet to be available, do open an issue, describing why and what the feature could bring and how it would help you!
License
LocaleComplete is available under the MIT license. See the LICENSE file for more info.