DayPeriodFormatter
DayPeriodFormatter copied to clipboard
Regional Variants Aren't Being Used
Currently, DayPeriodFormatter
only uses a locale's language code to determine the day period string. However, some rule sets have regional variations, such as es_cO
, for "Spanish (Colombia)". These should be selected for matching locales.
This should be as straightforward as changing the current implementation to make two checks, first with and then without the region code. The only real trick is matching the identifier format for case and punctuation (e.g. Locale.identifier
BCP 47 es-CO
-> CLDR key es_co
)
https://github.com/FormatterKit/DayPeriodFormatter/blob/0d888bf78307a2fd254d4df842336ccffa153c5c/Sources/DayPeriodFormatter/DayPeriodFormatter.swift#L23