-
Notifications
You must be signed in to change notification settings - Fork 781
Closed
Labels
Description
I would like to use localized strings in addition to NSLocale.currentLocale()
.
Pattern 1:
struct string {
struct localizable {
let locale: NSLocale
init(locale: NSLocale = NSLocale.currentLocale()) {
self.locale = locale
}
/// Locales: en, ja
static func helloWorld() -> String {
return String(format: NSLocalizedString("HelloWorld", comment: ""), locale: self.locale)
}
}
}
Pattern 2:
struct string {
struct en {
/// Locales: en, ja
static func helloWorld() -> String {
return String(format: NSLocalizedString("HelloWorld", comment: ""), locale: NSLocale(localeIdentifier: "en"))
}
}
}
luolong