Skip to content

fix(i18n): move lang/dict to module scope and translate coords button - #17

Merged
SKOHscripts merged 1 commit into
mainfrom
claude/tender-clarke-88XbU
May 27, 2026
Merged

SKOHscripts merged 1 commit into
mainfrom
claude/tender-clarke-88XbU

Conversation

@SKOHscripts

Copy link
Copy Markdown
Owner

Summary

  • Fix i18n detection scope : lang, labels et dict étaient définis à l'intérieur de applyFenToBoard(), les rendant inaccessibles aux autres fonctions (notamment initCoordsToggle()). Ils sont maintenant au niveau module, détectés une seule fois et partagés par toutes les fonctions.
  • Traduction du bouton Coords : initCoordsToggle() applique désormais dict.coords au texte du bouton. Traductions ajoutées pour les 12 langues supportées (fr/Coords, de/Koord., es‑it‑pt/Coord., nl/Koord., ru/Коорд., zh/坐标, ja/座標, pl‑tr/Koord., en/Coords).
  • Correction d'indentation : le bloc labels dans front.html était à colonne 0 à l'intérieur d'une fonction — corrigé.
  • Harmonisation : back.html adopte la même structure de labels que front.html (mêmes langues, même ordre de propriétés).

Test plan

  • Ouvrir une carte front/back en anglais → bouton affiche "Coords", "White to move" / "Black to move"
  • Changer la langue du navigateur/système en français → bouton affiche "Coords", "Trait aux blancs/noirs"
  • Tester avec une autre langue (ex. de, ja) → libellés et bouton traduits correctement
  • Vérifier que le toggle coords fonctionne toujours (affiche/masque les coordonnées)
  • Vérifier que la préférence coords est persistée via localStorage

https://claude.ai/code/session_01W4q82SG7ivHr15HiowDczK


Generated by Claude Code

- Extract `lang`, `labels`, and `dict` from inside `applyFenToBoard()` to
  module scope so `initCoordsToggle()` (and any future function) can access
  the active locale without re-detecting it.
- `initCoordsToggle()` now sets the button text from `dict.coords` instead
  of leaving the hardcoded "Coords" string.
- Add `coords` key to every language entry in both front and back templates
  (fr/Coords, de/Koord., es‑it‑pt/Coord., nl/Koord., ru/Коорд., zh/坐标,
  ja/座標, pl‑tr/Koord., en/Coords).
- Fix inconsistent indentation of the `labels` block in front.html (was at
  column 0 inside the function body).
- Sync back.html labels to match front.html structure (same languages, same
  property ordering).

https://claude.ai/code/session_01W4q82SG7ivHr15HiowDczK
@SKOHscripts
SKOHscripts marked this pull request as ready for review May 27, 2026 14:05
@SKOHscripts
SKOHscripts merged commit e065741 into main May 27, 2026
14 checks passed
@SKOHscripts
SKOHscripts deleted the claude/tender-clarke-88XbU branch May 27, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants