i18n library for PurgeBot. Embeds JSON translation files and exposes typed message keys that services use to look up translated strings.
import "github.com/PurgeBot-net/locale"
// Look up a message in a given language, falling back to en-GB.
locale.MsgPurgeAlreadyRunning.In(lang)
// With fmt.Sprintf args:
locale.MsgPurgeStatusFetching.In(lang, channelName)lang is a BCP 47 tag (e.g. "en-GB", "de") — typically taken from the Discord interaction's guild or user locale.
- Add or update keys in
translations/en-GB.json(the source file). - Crowdin picks up the changes automatically via
crowdin.ymland creates translation PRs for other locales. - Add a typed
Messagevar inmessages.goif introducing a new key.