Translation Guide š
Internationalization & Translation Guide¶
š Want to contribute a translation?
Quick Start: Check out TRANSLATING.md for a simple 5-step guide.
This page is for developers who want to understand the technical details of the i18n system.
MatchZy Auto Tournament ships with full frontend internationalization (i18n) using i18next and reactāi18next, plus Material UIās locale support.
This guide explains:
- How the i18n system is wired
- Where translation files live
- How to add a new language
- How to update existing translations
The goal is to make it easy for contributors to translate the UI without touching core logic.
1. Overview of the i18n Setup¶
- Library:
i18next+react-i18next - Browser language detection:
i18next-browser-languagedetector - Frontend entry:
client/src/i18n.ts - Provider:
I18nextProvideris configured inclient/src/main.tsx - MUI localization: MUI locale switches along with the active i18n language via
ThemeProvider - Locales directory:
client/src/locales/ - English (default):
client/src/locales/en/translation.json - Simplified Chinese:
client/src/locales/zh-CN/translation.json
At runtime:
i18n.tsloads the JSON resources for each language and configures i18next.main.tsxwraps the React app in anI18nextProviderand aThemeProviderthat picks the correct MUI locale (enUS/zhCN).- Components call
const { t } = useTranslation()and uset('some.key')for all userāvisible text. - A
LanguageSwitchercomponent in the main layout lets users switch languages; the choice is persisted (e.g. vialocalStorage).
2. File Layout & Naming Conventions¶
All frontend translations live in a single JSON per language:
client/src/locales/en/translation.jsonclient/src/locales/zh-CN/translation.json
Keys are grouped by feature / page / component, for example:
layout.*ā global layout and navigationdashboard.*ā dashboard pageteamsPage.*,playersPage.*,serversPage.*ā list pagesteamModal.*,playerModal.*,serverModal.*,mapModal.*ā core CRUD modalstournament.*ā tournament creation / live tournament flowseloTemplatesPage.*ā ELO template UIpublicLinks.*ā public link descriptions
Guidelines:
- Prefer nested namespaces (objects) rather than flat keys.
- Keep the same key structure across all languages.
- Use descriptive keys (
dashboard.stats.playerDistributionTitle) instead of embedding English in the key.
3. How to Add a New Language¶
3.1. Create a locale file¶
- Copy the existing English translation file:
Examples:
- German:
client/src/locales/de/translation.json -
Brazilian Portuguese:
client/src/locales/pt-BR/translation.json -
Open your new file and translate values only.
Do not change keys or the overall structure.
3.2. Register the language in i18n.ts¶
- Open
client/src/i18n.ts. - Add an import for your new JSON resource, similar to:
- Add it to the
resourcesobject:
const resources = {
en: { translation: en },
'zh-CN': { translation: zhCN },
de: { translation: de },
} as const;
- If needed, update
supportedLngs/fallbackLngin the i18n config to include your new language code.
3.3. Wire it into the language switcher (optional but recommended)¶
- Open
client/src/components/common/LanguageSwitcher.tsx. - Add another
MenuItemfor your locale:
- Ensure the
LanguageSwitcheruses the same language code you registered ini18n.ts(de,pt-BR, etc.).
Once this is done, rebuilding the frontend will make your language selectable and persisted.
4. How to Update Existing Translations¶
4.1. Find the key in code¶
In a React component, userāvisible strings should already be wrapped in t():
If you see a hardcoded English string instead:
- Replace it with a translation key:
- Add
dashboard.titleto each locale JSON (see below).
4.2. Edit the locale JSON¶
- Open
client/src/locales/en/translation.jsonand locate the relevant section (e.g."dashboard"). - Add or update the key:
- Open
client/src/locales/zh-CN/translation.json(and any other locales) and add the same key with the translated value:
- Run the frontend and verify in each language.
5. Pluralization & Interpolation¶
We use i18nextās standard pluralization and interpolation.
5.1. Interpolation¶
Example in code:
English JSON:
The {{count}} placeholder is replaced with the provided count value.
5.2. Pluralization¶
For countādependent labels, define one / other:
Usage in code:
Important: Keep the plural keys (one, other, etc.) in every locale file for the same base key.
6. MUI Localization (Dates, Tables, Builtāin Text)¶
Material UIās own texts (pagination labels, date pickers, etc.) are localized via MUI locale objects:
@mui/material/localeā e.g.enUS,zhCN- In
client/src/main.tsx, the theme is created with:
To support your language fully, you may:
- Import another MUI locale (if available), e.g.
deDEfor German. - Extend
getMuiLocaleto map your i18n language code to the correct MUI locale object.
If a MUI locale does not exist for your language, the UI will still work; only some builtāin component texts will remain in English.
7. Translation Workflow for Contributors¶
- Pick a language you want to add or improve.
- Sync main and create a branch:
- Add or update the locale JSON under
client/src/locales/. - Register your language in
client/src/i18n.tsand (optionally)LanguageSwitcher. - Run the frontend:
- Manually verify:
- Switch to your language via the ināapp language switcher.
- Walk through all major pages: Dashboard, Teams, Players, Servers, Tournament creation, Matches, Templates, ELO Templates, Settings, Dev Tools, Public Links.
- Commit your changes with a clear message (e.g.
Add: de locale). - Open a PR, briefly describing:
- Which language you added or updated
- Which areas of the UI you validated
8. Translation Quality Guidelines¶
- Aim for clear, professional UI wording rather than literal translations.
- Prefer terminology familiar to CS / esports admins (e.g. āBracketā, āBest of 3ā, āELOā, āSkill Ratingā).
- Keep tone consistent across pages (we use a friendly but professional voice).
- When in doubt, favor clarity over strict brevity.
If youāre unsure about a term (e.g. how to translate āSkill Ratingā vs āELOā), feel free to open a Draft PR or Discussion so we can align terminology across languages.