How can badges and groups be localized (multilingual)? During setup, I noticed that the titles of badges and groups do not switch with the theme language. How can I make badges and groups follow the theme switch?
The ability to localize custom badges and groups for a multilingual site doesnāt exist yet ā at the moment only posts, categories, and tags can be localized.
Okay, thank you. But why is it that the badges on this website (meta.discourse.org) switch language along with the theme? Is that caused by a translation feature? I suggest that the official team add multilingual customization settings for badges, groups, and tags; otherwise, multilingual users cannot understand the content of badges, groups, and tags.
There are some seeded badges on every site that are internationalised (i18n) through Crowdin.
Custom badges store name/description as plain text in the database. When I18n.t (internationalization feature) is called with a key like badges.my_custom_badge.name, thereās no matching translation, so it falls back to the stored DB value ā same text for all locales.
Thereās a workaround where admins can manually add translations for custom badge keys per locale.
You can customize your site texts at <your site>/admin/customize/site_texts.
Some concrete steps for you
- Create the badge
- Go to /admin/badges ā New Badge
- Set name, description, icon, etc. as normal
- Derive the i18n key
- The key pattern is
badges.{snake_case_name}.name - The snake_case_name is the badge name lowercased with spaces replaced by underscores
- So āPokĆ©mon Masterā ā
badges.pokƩmon_master.name
- Add translation overrides
- Go to /admin/customize/site_texts
- Search for
badges.pokĆ©mon_master - Youāll see keys like:
badges.pokƩmon_master.namebadges.pokƩmon_master.descriptionbadges.pokƩmon_master.long_description
- Switch to the target locale (e.g. ē®ä½äøę), click the key, and enter the translated text
- Repeat per locale
- Switch locale in the dropdown, add translations for each language you need
.name- badge title.description- short description shown on badge cards.long_description- full description shown on the badge detail page
english
japanese
Hi! Thanks for the reply! How is the second step, finding the āi18n key,ā implemented? I couldnāt find the location of the i18n key.
You donāt really āfindā it, just derive it from the name you will give the badge. (Will update the second step to use āderiveā instead of āfindā)
So if you use āBug Finderā as the badge name, the key will be badges.bug_finder.name
I donāt know why, but searching for anything in /admin/customize/site_texts always prompts āNo matching site texts foundā. Do you know what is causing this?
Oh apologies, I need to correct my previous steps!
The site texts admin page (/admin/customize/site_texts) can only find keys that already exist in Discourseās translation files. So unfortunately custom badge keys like badges.pokĆ©mon_master.name donāt exist there, and searching for them would return nothing (which is the issue youāre running into).
The screenshots I shared were from a setup where I created the translation entries via the Rails console. The admin UI steps I gave wonāt work as written. Sorry about the confusion. What actually works if you have console access, you can create translation overrides for custom badges:
# the key pattern is: badges.{name_in_snake_case}.{name|description|long_description}
# e.g. for a badge called "Pokemon Master":
TranslationOverride.upsert!("zh_CN", "badges.pokemon_master.name", "å®åÆę¢¦å¤§åø")
TranslationOverride.upsert!("zh_CN", "badges.pokemon_master.description", "ä½ ēęčæ°")
Once created via console, the translation will appear in /admin/customize/site_texts and can be edited from there going forward.
If you donāt have console access, this currently not possible. Localizing custom badges isnāt supported yet as @awesomerobot had mentioned.


