AlbertMontserrat / AMGLanguageManager

Language manager that offers the possibility to change the language of the app during the execution.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AMGLanguageManager

CI Status Version License Platform

Example

To initialize the singleton, just set the available languages in didFinishLaunching like this:

AMGLanguageManager.shared.initialize(withLanguages: ["en", "es"])

Then in code just

AMGLanguageManager.shared.localizedString(key: "str_key")

to retrieve the localized string.

You can also get localized resource path like this:

AMGLanguageManager.shared.localizedPath(forResource: "filename", ofType: "extension")

To change the language in any part of the app just set:

AMGLanguageManager.shared.setLanguage(name: "es")

You can use a String extension simply like this:

let localizedString = "key".amgLocalized()

Requirements

Installation

AMGLanguageManager is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "AMGLanguageManager"

Author

albert.montserrat.gambus@gmail.com

License

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

About

Language manager that offers the possibility to change the language of the app during the execution.

License:MIT License


Languages

Language:Swift 95.0%Language:Shell 3.8%Language:Objective-C 0.7%Language:Ruby 0.5%