localicious
localicious copied to clipboard
Percentages on iOS in strings with vs. without arguments
Due to the guard on the number of translationArgs, if a string contains a percentage sign, but not any placeholders, the percentage encoding isn't removed because it isn't used as a String format.
So it the yaml contains '42%', it shows up in Localizable.strings as '42%%' and in the UI as '42%%' too, but '%1{{s}} is 42%' comes true correctly.
Removing the guard fixes it.
let translationArgs = self.translationArgs ?? []
guard translationArgs.count > 0 else { return value }
return String(format: value, arguments: translationArgs)