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

Enforce localized sorting #40012

Merged
merged 3 commits into from
Apr 30, 2020

Conversation

jbytheway
Copy link
Contributor

Summary

SUMMARY: I18N "Use localized sorting in more places"

Purpose of change

Improved internationalization / localization.

Describe the solution

Add a clang-tidy check to look for string comparisons that probably ought to be using localized rather than simple comparisons.

Resolve all the warnings it produces:

  • Two cases were "just for insertion into std::set" comparisons. I switched those to use unordered_set instead.
  • The remaining cases were all genuine hits, and I converted them all to the new localized_compare (added in Localized sorting #39873)

Describe alternatives you've considered

Could have gone further, but for this initial check I decided to just look at less-than comparison of std::strings.

Testing

Looked at some of the UIs affected. They seem to be working as expected.

Additional context

I wasn't able to find anyone else to test the changes from #39873, but I did test the Windows build under Wine, and it seemed to work as expected there, which is hopeful.

@jbytheway jbytheway force-pushed the enforce_localized_sorting branch from 4990f9a to e9a9ace Compare April 29, 2020 17:06
It makes more sense to use an unordered_set for these objects, and it
has the added advantage that it avoids a string comparison.
The intention is to detect cases where a simple string comparison is
being performed, but a localized comparison would be more appropriate.
@jbytheway jbytheway force-pushed the enforce_localized_sorting branch from e9a9ace to 60372f0 Compare April 30, 2020 11:52
@mlangsdorf mlangsdorf added Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Translation I18n labels Apr 30, 2020
Copy link
Contributor

@ifreund ifreund left a comment

Choose a reason for hiding this comment

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

Thanks!

@ifreund ifreund merged commit 384377e into CleverRaven:master Apr 30, 2020
@jbytheway jbytheway deleted the enforce_localized_sorting branch May 1, 2020 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Translation I18n
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants