Created
July 23, 2018 15:49
-
-
Save Viveron/8c77e490ecaf1c2fdc8a79dc1b7901e1 to your computer and use it in GitHub Desktop.
Common type for aggregation all UI strings, that should be localized
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 | |
| typealias Localized = String | |
| extension Localized { | |
| func localize() -> String { | |
| return NSLocalizedString(self, comment: "") | |
| } | |
| /// Localize plural string key | |
| func localize<T>(_ count: T) -> String { | |
| return String.localizedStringWithFormat(self.localize(), count as! CVarArg) | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: