main ← fix/match-tag-icons-by-id
opened 06:16AM - 01 Apr 26 UTC
Tag icons break when content localization is enabled because the component match…es on `tag.name`, which gets translated. For example, a tag configured as `ai,robot,#5865F2` stops showing its icon when the user's locale translates the tag name to "intelligence-artificielle".
This switches all matching to use `tag.id` instead. On initialization, we build an ID map from `site.top_tags` (which is preloaded and available synchronously), resolving the configured tag names to their IDs via `tag.slug` (always the original untranslated value). The tag renderer, hashtag type, and sidebar icon registration all use this ID map.
For older Discourse versions that pass tags as strings (pre #36678), we fall back to name matching since there's no ID available.
See https://meta.discourse.org/t/399594
| en | ja |
|---|---|
| <img width="242" height="217" alt="Screenshot 2026-04-01 at 2 37 08 PM" src="https://github.com/user-attachments/assets/41507593-e666-4214-8ccf-ff8e0a898261" /> | <img width="245" height="215" alt="Screenshot 2026-04-01 at 2 37 01 PM" src="https://github.com/user-attachments/assets/9bbd59cf-e2fa-4a5b-9c74-906b21f96d0d" /> |
| |(previously, no icon would appear) |