-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Description
Right now, all bot messages are sent in a fixed language. For OpenSDB we want to support both German and English, so that each server (or guild) can decide which language the bot should use.
The goal of this feature is to introduce a simple language setting that can be changed via a command, and then automatically applies to all user-facing messages the bot sends (errors, help texts, verification flows, welcome messages, etc.).
Expected Behavior
-
The bot supports at least two languages:
de– Germanen– English
-
Each server can configure its preferred language using a command.
-
The selected language is saved in the database (e.g. in
ServerSettings) and is persistent across restarts. -
All user-facing messages use a central translation system instead of hard-coded text.
-
If a translation key is missing in the selected language, the bot falls back to a default language (e.g. English).
-
Language changes take effect immediately for all future messages from the bot in that guild.
Example Commands
/language get
→ Reply: "Current bot language for this server is: German (de)."
/language set de
→ Reply: "Bot language for this server has been set to: German (de)."
/language set en
→ Reply: "Bot language for this server has been set to: English (en)."
- Only users with a configurable permission (e.g.
admin/ server owner) can change the language. - Command names are just examples – final naming should be consistent with existing config commands (e.g.
/config language).
Proposed Technical Solution
-
Introduce a small i18n layer:
- Translation files, e.g.
locales/en.jsonandlocales/de.json. - Messages are referenced by keys (e.g.
verification.success,errors.missingPermission) instead of direct strings.
- Translation files, e.g.
-
Extend the
ServerSettingsmodel with alanguagefield (default:deoren). -
Add a helper like
t(guildId, key, placeholders?)that:- Looks up the guild’s language in the DB.
- Loads the correct translation file.
- Replaces placeholders (e.g.
{username}) if needed.
-
Gradually migrate existing messages to use the translation helper instead of hard-coded text.
Alternatives Considered
-
Separate bot instances for each language (e.g. one German bot, one English bot).
- Rejected because it’s harder to maintain, doubles configuration effort, and doesn’t scale well.
-
Environment variable for a global language setting.
- Rejected because each server should be able to choose its own language independently.
Additional Context
- This feature should be designed so that adding more languages later (e.g. French, Turkish) is just a matter of adding new locale files.
- It will also make it easier to keep messages consistent and update copy in one place instead of hunting for strings across the codebase.