DemoApp/DemoApp/Multilingual.swift in xcmultilingual-0.2.1 vs DemoApp/DemoApp/Multilingual.swift in xcmultilingual-0.2.2

- old
+ new

@@ -23,18 +23,19 @@ case RHINOCEROS = "RHINOCEROS" case GORILLA = "GORILLA" case MONKEY = "MONKEY" func string() -> String { - return NSLocalizedString(rawValue, tableName: "Animal", bundle: NSBundle.mainBundle(), value: "\(rawValue)", comment: "") + return NSLocalizedString(rawValue, tableName: Animal.name, bundle: NSBundle.mainBundle(), value: rawValue, comment: "") } static let name = "Animal" static var keys: [String] { return ["CAT", "DOG", "BEAR", "DEER", "SQUIRREL", "ELEPHANT", "GIRAFFE", "TIGER", "LION", "RABBIT", "RHINOCEROS", "GORILLA", "MONKEY"] } + static var localizations: [String] { return Animal.keys.map { Animal(rawValue: $0)!.string() } } } @@ -42,51 +43,54 @@ case HELLO = "HELLO" case GOODMORNING = "GOODMORNING" case GOODEVENING = "GOODEVENING" func string() -> String { - return NSLocalizedString(rawValue, tableName: "Localizable", bundle: NSBundle.mainBundle(), value: "\(rawValue)", comment: "") + return NSLocalizedString(rawValue, tableName: Localizable.name, bundle: NSBundle.mainBundle(), value: rawValue, comment: "") } static let name = "Localizable" static var keys: [String] { return ["HELLO", "GOODMORNING", "GOODEVENING"] } + static var localizations: [String] { return Localizable.keys.map { Localizable(rawValue: $0)!.string() } } } enum Sample2Sample_Localization: String { case SAMPLE_2 = "SAMPLE 2" func string() -> String { - return NSLocalizedString(rawValue, tableName: "Sample Localization", bundle: Multilingual.bundle("Loalizations/sample2.bundle"), value: "\(rawValue)", comment: "") + return NSLocalizedString(rawValue, tableName: Sample2Sample_Localization.name, bundle: Multilingual.bundle("Loalizations/sample2.bundle"), value: rawValue, comment: "") } static let name = "Sample Localization" static var keys: [String] { return ["SAMPLE 2"] } + static var localizations: [String] { return Sample2Sample_Localization.keys.map { Sample2Sample_Localization(rawValue: $0)!.string() } } } enum SampleSample: String { case SAMPLE = "SAMPLE" func string() -> String { - return NSLocalizedString(rawValue, tableName: "Sample", bundle: Multilingual.bundle("sample.bundle"), value: "\(rawValue)", comment: "") + return NSLocalizedString(rawValue, tableName: SampleSample.name, bundle: Multilingual.bundle("sample.bundle"), value: rawValue, comment: "") } static let name = "Sample" static var keys: [String] { return ["SAMPLE"] } + static var localizations: [String] { return SampleSample.keys.map { SampleSample(rawValue: $0)!.string() } } }