i18n WIP#1131
Closed
Aciid wants to merge 62 commits into
Closed
Conversation
Adds an optional locale column to the discord_guilds table so each guild can store its preferred language for i18n lookups. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds i18next with filesystem backend, locale files for en-US and fi, t()/getLocale()/getCommandLocalizations() helpers, a test suite, and an npm sync script that keeps non-default locales in sync with en-US. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Initialises i18next before Discord connects, exposes LOCALE env var, and loads translations before command modules are imported during deploy. Updates jest config to include i18n test coverage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wires t()/getLocale()/getCommandLocalizations() into every command so response strings and Discord slash command name/description registrations are driven by locale files instead of hardcoded English strings. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ignore Alphabetise imports in timer.ts and discord.ts. Add eslint-disable comments for dormant functions/vars in timer.ts that are intentionally commented out. Add .devcontainer/devcontainer-lock.json and docs/ to .gitignore. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ale dirs - Change getLocale() parameter from ChatInputCommandInteraction to BaseInteraction so it works with all interaction types (context menus, modals, etc.) without casting at call sites - Filter syncLocales to skip directories whose names don't match /^[a-zA-Z-]+$/ (e.g. macOS Finder duplicates like "en-US 2")
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds fi locale stubs for: birthday, bountyleaderboard, busyness, cooperative, counting, donate, dramacounter, h2flow, issue, karma, leaderboard, levels, opioidConverter, profile, quote, reminder, report, rss, say, search, selftimeout, sheesh, tent, timezone, tripsitstats. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Updates fi translations for: ai, avatar, bridge, calc, coinflip, combo, convert, ems, fact, feedback, help, hr, hydrate, invite, joke, kipp, learn, lovebomb, magick8ball, privacy, reactionRole, remindme, rockpaperscissors, setup, testkits, tictactoe, topic, translate, tripsitmode, triptacgo, triptoys. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Aligns the locale key name with the naming convention used by other body text keys, updating both locales and the Discord command reference. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Subcommand names (help, link, unlink, profile) need their own locale keys distinct from description keys so name localizations don't share the description string. Updates both locales and the Discord command. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace hardcoded g.about.ts static properties in d.help.ts with t(locale, 'help', key) calls so all body text is locale-aware. Add en-US and fi translations for all 9 body text keys. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace g.about.ts imports in d.setup.ts with t(locale, 'setup', key) calls for the 4 long description fields. Add en-US and fi translations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Refactor g.learn.ts link/unlink to return typed discriminated unions instead of raw English strings. Update d.learn.ts to resolve locale- aware messages via t(locale, 'learn', key). Add en-US and fi translations for all response keys including moodle help title/description/footer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
drug: add getCommandLocalizations to substance, section, and ephemeral options.
hr: replace hardcoded en-US builder strings with t('en-US', 'hr', key).
calc: replace hardcoded constants with t('en-US', 'calc', key) and add
getCommandLocalizations; add the 3 psychedelics options that had no
localizations at all. Add en-US and fi translations for new calc keys.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Convenience wrapper around getCommandLocalizations that accepts a single "ns.key" string, useful when the reference is constructed programmatically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Set up i18n-ally extension to recognise src/locales with en-US as the source language, flat key style, and namespace-per-file path matching. Add custom framework YAML so ally detects getCommandLocalizations and getCommandLocalizationsNs usage patterns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…namespaced refs
Add a second call signature to both functions so callers can pass a single
"ns.key" string instead of separate ns and key arguments. The first dot is
used as the separator, allowing keys that themselves contain dots.
This makes the call-site pattern t(locale, 'ns.key') and
getCommandLocalizations('ns.key') readable by i18n-ally, which cannot
parse the two-argument comma form. The previous getCommandLocalizationsNs
helper is removed since it is now redundant. The custom-framework regex
is updated to match both overloads.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…notation refs
Replace three-argument calls like t(locale, 'ns', 'key') and
getCommandLocalizations('ns', 'key') with the dot-namespaced overloads
t(locale, 'ns.key') and getCommandLocalizations('ns.key') across all
command files.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d/ since they are generated under src/
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Per-guild DB lookup removed — discord_guilds.locale write in /setup locale set is now a no-op (kept for re-enablement later). interaction and ns params retained to avoid touching ~58 call sites. Docs updated to describe the simplified resolution chain and the two independent locale axes (command metadata vs. reply content).
Per-guild locale resolution was never effective after getLocale() was simplified to env LOCALE only. Remove the dead surface area entirely: - Drop /setup locale get|set subcommands and autocomplete handler - Remove localeGet/localeSet functions and getAvailableLocales import - Drop discord_guilds.locale column and its migration - Remove locale keys from en-US and fi setup.json - Update getLocale() tests to match the simplified contract BREAKING CHANGE: /setup locale get and /setup locale set no longer exist. Re-deploy slash commands after merging (npm run tripbot:deployCommands).
Commit 2c2c603 accidentally committed local debug state that commented out nearly all scheduled timers (checkReminders, checkTickets, checkVoice, undoExpiredBans, checkBirthdays, etc.) and the checkVoice body. Restore the file to its main version so the timer loop runs the full schedule again.
This reverts commit e2bd540.
This reverts commit ae51df4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces full internationalization (i18n) infrastructure to TripBot and localizes the
overwhelming majority of user-facing commands. Adds a
fi(Finnish) locale alongside theen-USsource of truth as a working second locale, wires locale resolution into command deployment and runtime.This is a large but mostly mechanical branch: 204 files changed, ~10.3k insertions.
The bulk is locale JSON (121 files across two locales × 59 namespaces) and the command-builder edits
that reference those keys.
What's included
Infrastructure
src/i18n/index.ts) —t()andgetCommandLocalizations()helpers, namespace auto-discovery from
en-USfilenames, no code change needed to add a namespace.t()andgetCommandLocalizations()accept dot-namespaced refs(e.g.
idose.commandName), replacing the older(ns, key)form. i18n-ally VSCode config andregex updated to match peek translations.
getLocale()driven by envLOCALE; runtime falls back cleanly.src/scripts/syncLocales.ts,npm run i18n:sync) — keeps all localesin structural parity with
en-US, the single source of truth. Supports--dry.initI18n()runs before command modules load in bothsrc/start.tsandcommandDeploy.ts, so slash commands register with localized name/description./setup locale set <locale>, lives on guild table locale column.Command localization
body strings moved to locale files.
Housekeeping
src/(where they're generated).What's left out (intentional)
Excluded by design — not localized (9)
Staff/admin tooling and the RPG game are not user-facing harm-reduction surfaces, so they keep
literal English strings:
admin,mod,botmod,purge,clearchat,botstats,bottest,sayrpgRemaining user-facing, not yet localized (3)
All three are context-menu commands (not slash commands) and were deferred to a follow-up:
m.quotem.reportu.reportCoverage
Counts exclude archived commands and templates.
Notes for reviewers
en-USis the source of truth. Runnpm run i18n:sync -- --dryto confirm locale parity.src/locales/en-US/<name>.jsonnamespace — no code change needed.src/locales/langfolder to trigger structure auto create by runningnpm run i18n:syncE2EE TESTED AI DRIVEN CODE.