Created
December 11, 2016 15:49
-
-
Save alfian0/1210948c1530954ec1808a4d0b1c310c to your computer and use it in GitHub Desktop.
For get Localization String By Language Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| class Localization { | |
| static let instance: Localization = Localization() | |
| func getLocalizationBy(langCode: String, key: String) -> String? { | |
| guard let path = NSBundle.mainBundle().pathForResource(langCode, ofType: "lproj") else { return nil } | |
| let bundle = NSBundle(path: path) | |
| return bundle?.localizedStringForKey(key, value: nil, table: nil) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment