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

fix(text): use locale-independent letter case methods (#6016) #6204

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

lionel-rowe
Copy link
Contributor

Closes #6016

@lionel-rowe lionel-rowe force-pushed the text-locale-independent-letter-case branch from 33c4a3b to aaf3999 Compare November 22, 2024 07:25
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.54%. Comparing base (a73ff94) to head (b328479).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6204      +/-   ##
==========================================
+ Coverage   96.52%   96.54%   +0.01%     
==========================================
  Files         533      533              
  Lines       40870    40868       -2     
  Branches     6120     6120              
==========================================
+ Hits        39451    39454       +3     
+ Misses       1377     1372       -5     
  Partials       42       42              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kt3k
Copy link
Member

kt3k commented Nov 23, 2024

Could this change/fix any output with Turkish locale?

@kt3k kt3k merged commit 9daae05 into denoland:main Nov 28, 2024
18 checks passed
@lionel-rowe
Copy link
Contributor Author

Could this change/fix any output with Turkish locale?

@kt3k Sorry, only just noticed this comment after the merge. It would change such output to use "default" letter case conversions (which I think for all intents and purposes is the same as toLocaleXCase('en-US')).

It's possible there could be cases where the locale-sensitive version with the host locale is desirable, but I suspect such cases are rare, as it's usually better to explicitly specify a locale. For example, a Turkish-language-only website should consistently use Turkish letter case conventions even for users' whose browser/OS is in another language; meanwhile, a multilingual website supporting Turkish should use the locale of the current content. In cases where the locale is unknown, perhaps the host locale could be used as a fallback, with the usual caveats about potential bugs (string comparison etc).

@kt3k
Copy link
Member

kt3k commented Nov 28, 2024

No worries. I agree this is generally a good convention. Thanks for your contribution.

I was just wondering if we should tag this PR refactor if there's no actual fixed case, but that was not a big deal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use of locale-sensitive methods with undefined locale may cause environment-sensitive bugs
2 participants