mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 03:01:21 +02:00
Updated CONTRIBUTING.md
This commit is contained in:
+11
-14
@@ -223,21 +223,18 @@ The frontend uses [react-i18next](https://react.i18next.com/) for all user-facin
|
|||||||
|
|
||||||
### Locale Files
|
### Locale Files
|
||||||
|
|
||||||
Translations live in `frontend/src/i18n/locales/`:
|
Translations live in `frontend/src/i18n/locales/`. `en.ts` is the reference locale; every other `*.ts` file in that directory is checked against it. The parity check discovers the directory at runtime, so a new locale is picked up automatically — this file never needs updating when one is added.
|
||||||
|
|
||||||
| File | Language |
|
To see the current set of locales and check your work:
|
||||||
|------|----------|
|
|
||||||
| `en.ts` | English (primary) |
|
```bash
|
||||||
| `de.ts` | German |
|
cd frontend
|
||||||
| `fr.ts` | French |
|
npm run check:i18n
|
||||||
| `ja.ts` | Japanese |
|
```
|
||||||
| `pt-BR.ts` | Brazilian Portuguese |
|
|
||||||
[...]
|
|
||||||
check for possibly more files!!!
|
|
||||||
|
|
||||||
### Adding New Strings
|
### Adding New Strings
|
||||||
|
|
||||||
1. Add the key to the appropriate section in **all three** locale files
|
1. Add the key to the appropriate section in **every** locale file
|
||||||
2. Use the `useTranslation` hook in your component:
|
2. Use the `useTranslation` hook in your component:
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
@@ -253,9 +250,9 @@ function MyComponent() {
|
|||||||
|
|
||||||
### Important Notes
|
### Important Notes
|
||||||
|
|
||||||
- All three locale files must use the **same key structure** — same nesting, same key paths
|
- Every locale file must use the **same key structure** — same nesting, same key paths
|
||||||
- Always add keys to all three locales to maintain parity
|
- Always add keys to **every** locale to maintain parity, with real translations rather than English placeholders — the check flags leaves that are identical to `en`
|
||||||
- Run frontend tests after changes — locale parity is validated
|
- Run `npm run test:run` before pushing — it chains the parity check, which CI runs too. Plain `npm test` is vitest in watch mode and skips it
|
||||||
- If you find structural inconsistencies between locales, fix them — different key paths cause silent fallback to English
|
- If you find structural inconsistencies between locales, fix them — different key paths cause silent fallback to English
|
||||||
|
|
||||||
## Authentication & Permissions
|
## Authentication & Permissions
|
||||||
|
|||||||
Reference in New Issue
Block a user