iOS: Date formatter with "ar_AE" language code not converting date to Arabic

435 Views Asked by At

When I try to convert date to Arabic language with below code & ar_AE language code, it shows date in western numerals not in Arabic.

let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
dateFormatter.locale = Locale.init(identifier: "ar_AE")
lblDate.text = dateFormatter.string(from: Date())

Output:

enter image description here

once I change the language code / local identifier to ar_OM or ar_SD or any other arabic countries it works in iOS.

let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
dateFormatter.locale = Locale.init(identifier: "ar_OM")
lblDate.text = dateFormatter.string(from: Date())

Output:

enter image description here

Tested on iOS 15.5 & 13.3, there is nothing related to iOS version.

Also ar_AE shows dates in Arabic in Android & https://nsdateformatter.com/

Request someone to help me to understand the reason why "ar_AE" code is not working while if I provide identifier "ar" it works perfectly & that would be great help if we can resolve this.

0

There are 0 best solutions below