feat(i18n): add Spanish (es) locale - #5656
Open
albert210596 wants to merge 1 commit into
Open
Conversation
Adds a complete Spanish translation of the panel, bringing the locale
count to three (en / zh / es).
- New `frontend/src/i18n/locales/es/` with all 16 message files,
mirroring the `en/` tree key for key (8,871 keys, verified equal).
- Register `es` in `i18n/index.ts`: `LocaleCode`, `localeLoaders`,
`isLocaleCode`, browser-language detection and `availableLocales`
(the switcher renders it automatically).
- Extend `localesMessageCompile.spec.ts` to precompile `es` too, so
unescaped placeholders in Spanish text fail at test time.
- `DateRangePicker` and `KeyUsageView` format dates with `es-ES` when
the locale is Spanish (they previously fell back to `en-US`).
Verification: `vue-tsc --noEmit` clean; the message-compile test passes
for all three locales; the rest of the suite matches the pre-change
baseline. Placeholders (`{count}`, `{name}`, escaped `{'@'}`/`{'{'}`)
were checked programmatically against `en` — all identical.
Spanish is the world's second-most-spoken native language and the panel
had no Latin-script locale besides English, so this makes Sub2API usable
for operators and end users across Spain and Latin America.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
All contributors have signed the CLA. ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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
Adds a complete Spanish (
es) locale to the panel, bringing the locale count to three (en/zh/es).Spanish is the second-most-spoken native language in the world, and the panel had no Latin-script locale other than English. This makes Sub2API usable for operators and end users across Spain and Latin America without relying on browser auto-translation (which mangles the tables, tooltips and the driver.js onboarding tour).
What's in it
frontend/src/i18n/locales/es/— all 16 message files, mirroring theen/tree file for file and key for key.frontend/src/i18n/index.ts—esregistered inLocaleCode,localeLoaders,isLocaleCode, browser-language detection (navigator.languagestarting withes) andavailableLocales.LocaleSwitcherpicks it up automatically fromavailableLocales, so no component change was needed.frontend/src/i18n/__tests__/localesMessageCompile.spec.ts—esadded to the precompile matrix, so an unescaped{in Spanish copy fails in CI instead of blowing up a component tree at runtime.DateRangePicker.vue/KeyUsageView.vue— these two branch onlocale.value === 'zh' ? 'zh-CN' : 'en-US'fortoLocaleDateString; Spanish now maps toes-ESinstead of silently falling back toen-US.Translation notes
enexists ines, and no key exists inesthat is not inen— checked programmatically over the flattened trees (8,871 keys, exact match on both sides).{placeholder}tokens were diffed key-by-key againsten— identical in every string. Escaped literals ({'@'},{'{'}billing_header{'}'}), pluralization pipes and the HTML inside the onboarding-tour strings were preserved.x-api-key, RPM/RPD, Claude Code, Codex, Bedrock, Vertex…), matching how these terms are actually used by Spanish-speaking operators.ordenador/computadoraand similar splits avoided) so it reads correctly on both sides of the Atlantic.Verification
vue-tsc --noEmit— clean.vitest run src/i18n/__tests__/localesMessageCompile.spec.ts— 3/3 pass (zh,en,es).vitest run— same result as the pre-change baseline on the same machine (the handful of failures there reproduce on unmodifiedmainand are unrelated to i18n).Happy to adjust any wording if maintainers or other Spanish-speaking users prefer different terminology.