Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@shopify/name - custom name formatter should be selected from top-level locale #2680

Open
2 tasks done
trishrempel opened this issue Aug 18, 2023 · 0 comments
Open
2 tasks done
Labels

Comments

@trishrempel
Copy link
Contributor

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant