Badge Display Order Differs Between English and Simplified Chinese Locales

Hi,

I noticed a discrepancy in the badge display order between English and Simplified Chinese locales on the /badges page.


Issue:

  • In English mode, badges are displayed in the correct order (e.g., TS1 appears before TS2).
  • In Simplified Chinese mode, the order is reversed (TS2 appears before TS1), even though the position values in the database are the same.
  • This behavior is consistent on the official Discourse forum, so it is not related to custom settings.

Steps to Reproduce:

  1. Go to the /badges page on a Discourse instance.
  2. Switch the interface language to English and note the badge order.
  3. Switch the interface language to Simplified Chinese and note that the order of the same badges is reversed.

Expected Behavior:
Badges should always be displayed according to their position values, no matter which language is selected.

Thank you for looking into this!

1 Like

I think they are in alphabetical order (per color: bronze first, then silver, finally gold).

I don’t think it’s a bug that badges are ordered alphabetically. There are some other topics about cases where the alphabetical order does not lead to the best positioning, like Very teeny tiny minor issue with the default badge ordering & Badge order doesn't make sense.
I think you could change the order with CSS (Trust levels order exhibition in the badges page - #3 by awesomerobot) or use the suggestion to add numbers in front by customizing the text.

2 Likes

That would make sense, since 基 starts with a ‘j’ but 成 starts with a ‘c’, assuming Discourse uses Pinyin for this.

EDIT: From what I can see, Discourse uses localeCompare.

Thanks for the report!

I’m adding a pr-welcome here in case anyone wants to have a stab at it.

1 Like