`@shopify/name` - custom name formatter should be selected from top-level locale
trishrempel opened this issue · comments
Overview
This line in src/formatName.ts selects a custom name formatter based on the locale passed in to formatName()
.
However, if the locale passed in is not top level or otherwise doesn't match this list exactly, the custom formatter will not be selected, and the name will instead be formatted as a Latin locale name.
Consuming repo
What repo were you working in when this issue occurred?
None - discovered while reading the code.
Suggested solution
Split locale
by -
(maybe use a regex to split by either -
or _
), and retain only the first portion when selecting the custom name formatter.
Update [the constant](this list) to only key by top-level locales (zh-CN
and zh-TW
are formatted the same anyways, so they can be replaced with zh
).
Checklist
- Please delete the labels section before submitting your issue
- I have described this issue in a way that is actionable (if possible)