This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
@shopify/name
- custom name formatter should be selected from top-level locale
#2680
Open
2 tasks done
Labels
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
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
andzh-TW
are formatted the same anyways, so they can be replaced withzh
).Checklist
The text was updated successfully, but these errors were encountered: