feat(i18n): add Spanish (es-MX) locale support#280
Open
ellaguno wants to merge 4 commits intoTHU-MAIC:mainfrom
Open
feat(i18n): add Spanish (es-MX) locale support#280ellaguno wants to merge 4 commits intoTHU-MAIC:mainfrom
ellaguno wants to merge 4 commits intoTHU-MAIC:mainfrom
Conversation
Add complete Spanish (Mexican) translations for the entire UI: - All 5 i18n translation files (common, stage, chat, generation, settings) - Language selector in header with ES option - Browser language auto-detection for Spanish - Generation toolbar supports es-MX for course content language - Updated all type definitions to accept 'es-MX' locale - Updated normalizeLanguage and all language validation checks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Browser extensions (translators, Grammarly, etc.) can modify bare text
nodes in the DOM. When React tries to swap button content between a
text label and a spinner, it fails with "removeChild: node is not a
child" because the extension replaced the original text node.
Wrapping `{t(...)}` calls inside `<span>` elements gives React a
stable element reference that survives external DOM mutations.
Fixed in: provider-config-panel, pdf-settings, model-edit-dialog,
video-settings, image-settings, tts-settings.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The language selector showed 'CN' momentarily on page load because the SSR default locale is zh-CN and localStorage is only read in useEffect after mount. Now shows '...' until client hydration completes, then displays the correct locale label (CN/EN/ES). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…is resolved The server always renders with defaultLocale (zh-CN) but the client may detect a different locale from localStorage or browser language. This caused React hydration mismatches on every translated string. Fix: render children with visibility:hidden until the useEffect hydrates the correct locale from localStorage/browser, then reveal. This prevents the SSR zh-CN text from conflicting with client-side es-MX/en-US text, and also prevents browser translator extensions from intercepting the wrong-language text during the flash. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Closes #279
Changes
*EsMXexports with full Spanish translations (common, stage, chat, generation, settings)Localetype,VALID_LOCALES, browser detection, andgetClientTranslation'zh-CN' | 'en-US'unions to include'es-MX', updatednormalizeLanguage()Test plan
es-*→ app should auto-detect and default to Spanishnpx tsc --noEmit— passes with 0 errorspnpm lint— 0 new errors (only pre-existing warnings)🤖 AI-assisted with Claude Code — reviewed by @ellaguno