Created
May 24, 2016 21:56
-
-
Save swilliams/099405b597bd17e3515f2574f2a6dc39 to your computer and use it in GitHub Desktop.
This file contains 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
extension String { | |
var localized: String { | |
return NSLocalizedString(self, comment: "") | |
} | |
} | |
// Which allows for: | |
"Hello world".localized |
[Apologies for the big delay... I don't check GitHub often anymore]
It's been a long time since I used this, but if I recall, I had to manually create them.
Hey, thank you for the answer!
I'm not sure I follow, what do you mean by manually created them?
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
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
Hi, can you tell me how did you generate the Localizable.strings file?
While using a similar extension I was not able to generate the file, a lot of the strings are missing inside the generated one (both the one by Xcode as the one generated by genstrings)