Мне нужно локализовать строку, которая имеет некоторую переменную, а локализованная строка должна быть определена с помощью key: value: comment. Ребята, я много пробовал, но пока не понял. Смотрите здесь ...NSLocalizedString (ключ: значение: комментарий:) с переменной не работает в swift
let timeValue = 5
let timeString = "hours"
//Bellows are working fine
dateLabelString = String(format: "Overdue by %d %@", timeValue,timeString) //Working //Normal flat string
dateLabelString = String(format: NSLocalizedString("Overdue by %d %@", comment: "Overdue by 5 days/hours/minutes/seconds"), timeValue,timeString) //Working
dateLabelString = String.localizedStringWithFormat(NSLocalizedString("Overdue by %d %@", comment: "Overdue by 5 days/hours/minutes/seconds"), timeValue,timeString) //Working
dateLabelString = NSString.init(format: "Overdue by %d %@", timeValue,timeString) as String //Working
dateLabelString = NSString.init(format: NSLocalizedString("Overdue by %d %@", comment: "Overdue by 5 days/hours/minutes/seconds"), timeValue,timeString) as String //Working
//Bellows are not working
dateLabelString = String(format: NSLocalizedString("OVERDUE_BY", value: "Overdue by %d %@", comment: "Overdue by 5 days/hours/minutes/seconds"), timeValue,timeString) //Not Working
dateLabelString = String.localizedStringWithFormat(NSLocalizedString("OVERDUE_BY", value: "Overdue by %d %@", comment: "Overdue by 5 days/hours/minutes/seconds"), timeValue,timeString) //Not Working
dateLabelString = NSString.init(format: NSLocalizedString("OVERDUE_BY", value: "Overdue by %d %@", comment: "Overdue by 5 days/hours/minutes/seconds"), timeValue,timeString) as String //Not Working
Xcode: 8.2.1 Swift: 2,3
Уведомление проблема для включения ключа на NSLocalizedString, в противном случае его прекрасно работает. Мне нужен ключ.
Спасибо так много. Оно работает :) – kallol