Skip to content

Instantly share code, notes, and snippets.

@alfian0
Created December 11, 2016 15:49
Show Gist options
  • Select an option

  • Save alfian0/1210948c1530954ec1808a4d0b1c310c to your computer and use it in GitHub Desktop.

Select an option

Save alfian0/1210948c1530954ec1808a4d0b1c310c to your computer and use it in GitHub Desktop.
For get Localization String By Language Code
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