Skip to content

Instantly share code, notes, and snippets.

@swilliams
Created May 24, 2016 21:56
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save swilliams/099405b597bd17e3515f2574f2a6dc39 to your computer and use it in GitHub Desktop.
Save swilliams/099405b597bd17e3515f2574f2a6dc39 to your computer and use it in GitHub Desktop.
extension String {
var localized: String {
return NSLocalizedString(self, comment: "")
}
}
// Which allows for:
"Hello world".localized
@swilliams
Copy link
Author

My memory is really foggy on this, but I remember creating the localizable.strings files myself. I believe Xcode has the capabilities of doing that now. You'd still need to populate those files with strings though. This site has a little more info: https://medium.com/lean-localization/ios-localization-tutorial-938231f9f881

@josecostamartins
Copy link

Thank you very much for your time and your knowledge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment