[2.0.76] Strings containing rich text icons are sorted incorrectly in English and non-English localisations
Posted: Tue Mar 03, 2026 2:57 pm
I propose that the default sort order of rich text icons is incorrect in, separately, both English and non-English localisations. I suggested this (viewtopic.php?t=97719) 5 years ago and as time goes on I am more convinced that the current ordering is a detriment to the player's experience.
This negatively affects the game any time a list of custom strings is presented in a sorted order - for example, when selecting a train stop destination from a dropdown, or when space platforms are listed in the map view, as well as any lists added by mods. This is particularly impactful when using the wildcard modifier in train stop names (https://factorio.com/blog/post/fff-395) as that pretty much requires defining those names around the icon.
Number 1:













Number 2:













Number 1 is the current in-game sort order of rich text icons. When rich text strings are sorted, the rich text is not processed specially at all, it's just treated as e.g. "[item=iron-plate]". The resulting sort order is effectively the result of sorting the items alphabetically by their internal ID. The same applies to different kinds of icons, e.g. achievements are sorted before fluids are sorted before items are sorted before technologies.
Number 2 is the current in-game sort order of icons in pretty much every other circumstance, e.g. in the inventory, crafting menu, factoriopedia, signal picker. IMO it fundamentally makes sense that all icons should always be ordered this way, and IMO it is a bug that they are not.
It is at least consistent in that the items are alphabetised by item ID. Except...
And that only applies to base Factorio IDs. Modded IDs could be in any language the mod developer chooses, and sorted inconsistently as a result.
The procedure I used was:
entity.order makes sure icons are sorted within their groups, entity.subgroup.order makes sure entities are ordered by which inventory row they appear in, entity.group.order makes sure entities are ordered by which inventory tab they appear in. I don't think each set of prototypes has a defined order but I also don't think they're often mixed so it's probably fine.
This is localisation-agnostic as it uses the ordering properties that already exist and that are consistent in all localisations.
I did not notice any performance impact from this at all, however, I only tried adding 1 extra sorted list and Lua cannot modify all lists in the game as I am proposing.
This negatively affects the game any time a list of custom strings is presented in a sorted order - for example, when selecting a train stop destination from a dropdown, or when space platforms are listed in the map view, as well as any lists added by mods. This is particularly impactful when using the wildcard modifier in train stop names (https://factorio.com/blog/post/fff-395) as that pretty much requires defining those names around the icon.
English
Which of the following icon orderings feels more correct?Number 1:













Number 2:













Number 1 is the current in-game sort order of rich text icons. When rich text strings are sorted, the rich text is not processed specially at all, it's just treated as e.g. "[item=iron-plate]". The resulting sort order is effectively the result of sorting the items alphabetically by their internal ID. The same applies to different kinds of icons, e.g. achievements are sorted before fluids are sorted before items are sorted before technologies.
Number 2 is the current in-game sort order of icons in pretty much every other circumstance, e.g. in the inventory, crafting menu, factoriopedia, signal picker. IMO it fundamentally makes sense that all icons should always be ordered this way, and IMO it is a bug that they are not.
It is at least consistent in that the items are alphabetised by item ID. Except...
Non-English
The current rich text icon sort cannot ever make sense in any language other than English, because the IDs are in English. In other languages the order is nonsensical and arbitrary. The order is objectively incorrect.And that only applies to base Factorio IDs. Modded IDs could be in any language the mod developer chooses, and sorted inconsistently as a result.
Solution
Using the inventory's sort order to sort rich text is trivial. I proved this with a now-outdated proof-of-concept mod that adds an intuitively-sorted list of train stops to the locomotive UI: https://mods.factorio.com/mod/ordered-r ... rain-stopsThe procedure I used was:
- Before sorting, extract from the string all substrings that look like rich text icons ("%[([a-z]+)=(.-)%]") to get the prototype name and the entity ID (e.g. prototype=item, entity=iron-plate)
- For each substring, look up that entity ID in the corresponding prototype to get the entity
- Concatenate that entity's order properties (which determine its placement in the inventory list) to create a string (e.g. entity.group.order + entity.subgroup.order + entity.order)
- Substitute that string back into the original string in place of the rich text
- Proceed with the sort
entity.order makes sure icons are sorted within their groups, entity.subgroup.order makes sure entities are ordered by which inventory row they appear in, entity.group.order makes sure entities are ordered by which inventory tab they appear in. I don't think each set of prototypes has a defined order but I also don't think they're often mixed so it's probably fine.
This is localisation-agnostic as it uses the ordering properties that already exist and that are consistent in all localisations.
I did not notice any performance impact from this at all, however, I only tried adding 1 extra sorted list and Lua cannot modify all lists in the game as I am proposing.
Related bug reports
- [0.18.10] Rich text train station names are not searchable: This is a bug report about a user failing to find a string that contained rich text in a search because they didn't know they had to search for the item ID. This could in theory be solved by, similar to my proposed solution above, replacing (or extending) strings that contain rich text with the localised name of the represented entity (e.g. search in a list that contains "[item=iron-plate]", and what is actually searched behind the scenes is "[item=iron-plate]Iron plate"). Otherwise the bug report is not related.
- [0.17.39] Mods with icon beside their name not sorted correctly: I don't think this is relevant because the rich text icon is at the end of the mod name, not the start, so it shouldn't have affected the sort order? I don't think it's related. Regardless, the response to that thread was quite abrasive towards mod developers choosing to put icons in their mod names, but this bug report is about icons in ALL sorted lists, which is an intentional game feature (FFF-395).