swift-foundation
swift-foundation copied to clipboard
Implement `Locale.canonicalIdentifier`
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.