No. setlocale()
and strftime()
does not work in IPhone iOS C, just NULL.
And the ANSI C localeconv()
does not work in IPhone iOS C:
struct lconv *localeconv(void);
Also the standard Unix way of getting user name, does not work in Android.
char *p = getenv("USER");
So you need to use the Swift side to get the locale information.
let RFC3339DateFormatter = DateFormatter()
RFC3339DateFormatter.timeZone = TimeZone(secondsFromGMT: 0)
RFC3339DateFormatter.dateFormat = "yyyy-MM-dd"
let LocaleDateFormatter = DateFormatter()
LocaleDateFormatter.locale = Locale(identifier: Locale.preferredLanguages[0]) //NSLocale.current.identifier)
LocaleDateFormatter.dateStyle = .short
let DateString = LocaleDateFormatter.string(from: RFC3339DateFormatter.date(from: "3333-11-22")!)
let LocaleCountry = NSLocale.current.regionCode
let LocaleLanguage = Locale.preferredLanguages[0]
let LocaleCurrency = NSLocale.current.currencyCode
let LocaleShortDateTimePattern = DateString
let LocaleDecimalSeparator = NSLocale.current.decimalSeparator
let LocaleThousandSeparator = NSLocale.current.groupingSeparator
let LocaleThousandGrouping = "3;0",/* ThousandGrouping locale looks not be implemented by Apple*/
let LocaleNegativePrefix = NumberFormatter().negativePrefix
let LocaleNegativeSuffix = NumberFormatter().negativeSuffix
let Operator = NSUserName()
And then to be used in the C-code, call a C-function with the Swift locale data as parameters and store them there.