swift-foundation icon indicating copy to clipboard operation
swift-foundation copied to clipboard

Implement `Locale.canonicalIdentifier`

Open parkera opened this issue 2 years ago • 0 comments

Locale's canonicalIdentifier depends on a table in CoreFoundation: https://github.com/apple/swift-corelibs-foundation/blob/main/CoreFoundation/Locale.subproj/CFLocaleIdentifier.c

Without support for constant collections in Swift, a naive port of this would result in a pretty large allocation and memory usage regression. We may be able to take advantage of some of ICU's support for canonicalization, but we will need to verify compatibility with the existing implementation. Some callers may be expecting some of the legacy conversions to continue to work.

parkera avatar Apr 18 '23 20:04 parkera