Skip to content

Conversation

@dsas
Copy link

@dsas dsas commented Sep 30, 2024

The theme navigation includes a count of themes matching the current query. It's currently displayed as a straight number e.g. "6916". It is slightly nicer if the number is displayed with a locale-specific thousands separator.

Before After
Screenshot 2024-09-30 at 18 23 58 Screenshot 2024-09-30 at 18 20 56

Trac ticket: https://core.trac.wordpress.org/ticket/62138


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

The theme navigation includes a count of themes matching the current
query. It's currently displayed as a straight number e.g. "6916".
It is slightly nicer if the number is displayed with a locale-specific
thousands separator.
@github-actions
Copy link

github-actions bot commented Sep 30, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @rcrdortiz.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core Committers: Use this line as a base for the props when committing in SVN:

Props dsas.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.


renderThemeCount: function( count ) {
this.liveThemeCount = count;
const currentLocale = document.documentElement.lang;
Copy link

Choose a reason for hiding this comment

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

For some reason this does not work when updating my profile language to Spanish:

English Spanish
Screenshot 2024-10-07 at 10 14 05 Screenshot 2024-10-07 at 10 14 43

Copy link
Author

Choose a reason for hiding this comment

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

According to the standards the correct way in Spanish is to only group thousands if the number is greater than or equal to 10000. See https://st.unicode.org/cldr-apps/v#/es/Symbols/70ef5e0c9d323e01

Checking, and this bears out, if I run:

const n = 8456;
console.log(
  n.toLocaleString('en'),
  n.toLocaleString('es'),
  n.toLocaleString('es-es'),
  n.toLocaleString('es-mx'),
);

I get: "8,456", "8456", "8456", "8,456" i.e. Spanish from Spain has no thousands separator

If I run:

const n = 98456;
console.log(
  n.toLocaleString('en'),
  n.toLocaleString('es'),
  n.toLocaleString('es-es'),
  n.toLocaleString('es-mx'),
);

I get: "98,456", "98.456", "98.456", "98,456" i.e. a thousands separator is present.

Copy link

Choose a reason for hiding this comment

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

According to the standards the correct way in Spanish is to only group thousands if the number is greater than or equal to 10000

TIL!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants