-
Notifications
You must be signed in to change notification settings - Fork 394
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
fix(cli): sorting issue when different locales are used on host machines #1808
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Good catch. I also refresehd documentation of
Catalogs could be quite large, so instead of creatiing collator inside sort(), you could create it outside of the loop. |
@thekip should I update PR? it is okay to use |
I think it's fine. Just add a comment with explanation why we hard-code the en-US and probably link to this PR, just to quicker find the reason in future. |
Added a hardcoded 'en-US' locale to the Intl.Collator in the orderByMessage function within api/catalog.ts. This is to guarantee consistent sorting across different environments. This change was informed by the discussion in the pull request lingui#1808.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kepro thank you!
YW! but looks like your size testing has also order problems |
size-limit report 📦
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1808 +/- ##
==========================================
+ Coverage 76.27% 76.28% +0.01%
==========================================
Files 81 81
Lines 2074 2075 +1
Branches 529 529
==========================================
+ Hits 1582 1583 +1
Misses 380 380
Partials 112 112 ☔ View full report in Codecov by Sentry. |
Description
localeCompare
produces different sort output based on user machine localese.g. colleague in Denmark
da-DK
, meen-US
examples:
this was causing different orders of messages committed by different users (we are using format-json minimal)
we have translations like examples above when difference is only in casing
Opening Entry
vsOpening entry
Types of changes
Fixes # (issue)
Checklist