I've updated my project to iOS 13 and I've realised that the price formatter I was using for formatting the prices has stopped working correctly.
The groupingSeparator
, the symbol that groups the thousands, is missing for 4 digits numbers: from 1000 to 9999 when using a the Spanish locale es_ES
.
Below there is a simple snipped to verify it.
NumberFormatter
seems to be working perfectly for en_US
locale and for numbers higher than 9999 but whenever use es_ES
locale and try to format a 4 digits number, the groupingSeparator
(thousands separator) is missing, so instead of getting 1.000, I'm getting 1000.
let enFormatter = NumberFormatter()
enFormatter.locale = Locale(identifier: "en_US")
enFormatter.numberStyle = .decimal
enFormatter.string(from: 1000)
enFormatter.string(from: 9999)
enFormatter.string(from: 10000)
enFormatter.string(from: 100000)
let esFormatter = NumberFormatter()
esFormatter.locale = Locale(identifier: "es_ES")
esFormatter.numberStyle = .decimal
esFormatter.string(from: 1000)
esFormatter.string(from: 9999)
esFormatter.string(from: 10000)
esFormatter.string(from: 100000)
Just paste it into a playground and check the outputs.
Am I missing something?
So far I've reported the problem to Apple: FB7416623
https://feedbackassistant.apple.com/feedback/7416623 (not sure if the link works)
I'll keep this updated, but I would appreciate if anybody has more information about it.
es_ES