Posts

Post not yet marked as solved
3 Replies
Fixed. //class Bundle: Foundation.Bundle { // override func localizedString(forKey key: String, value: String?, table tableName: String?) -> String { // if let bundle = YDWLocalizationHelper.shared.language.bundle { // return bundle.localizedString(forKey: key, value: value, table: tableName) // } else { // return super.localizedString(forKey: key, value: value, table: tableName) // } // } //} func KWLocalizedString(_ key: String, comment: String) -> String { if let bundle = YDWLocalizationHelper.shared.language.bundle { return NSLocalizedString(key, tableName: nil, bundle: bundle, value: "", comment: comment) } else { return NSLocalizedString(key, comment: comment) } }
Post not yet marked as solved
3 Replies
Fixed. // 当调用YDWLocalizationHelper.Language切换语言后替换掉mainBundle为当前语言的bundle //class Bundle: Foundation.Bundle { // override func localizedString(forKey key: String, value: String?, table tableName: String?) -> String { // if let bundle = YDWLocalizationHelper.shared.language.bundle { // return bundle.localizedString(forKey: key, value: value, table: tableName) // } else { // return super.localizedString(forKey: key, value: value, table: tableName) // } // } //} func KWLocalizedString(_ key: String, comment: String) -> String { if let bundle = YDWLocalizationHelper.shared.language.bundle { return NSLocalizedString(key, tableName: nil, bundle: bundle, value: "", comment: comment) } else { return NSLocalizedString(key, comment: comment) } }