chore: add Español - es-ES language support #533
Conversation
📝 WalkthroughWalkthroughAdds a new Spanish (es-ES) translation bundle to the i18n package, exports it from the translations index, updates CONTRIBUTING.md testing instructions, and includes a changeset declaring a minor version bump for ChangesSpanish translation bundle addition
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add es-ES translation bundle, register it in the translations index, add a changeset, and document build/testing caveats in CONTRIBUTING.md.
24b120a to
2aac90d
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/i18n/src/translations/es-ES.ts`:
- Line 59: The Spanish translation in es-ES still uses the English label for the
elements.fields.email.label key, causing mixed-language UI text. Update the
translation entry in the es-ES locale file to a Spanish label such as “Correo
electrónico”, keeping the same key so the translations lookup continues to work
correctly.
In `@packages/i18n/src/translations/index.ts`:
- Around line 19-27: `es_ES` is exported from the translations index but not
loaded by the default bundle list, so add `es-ES` to
`TranslationBundleConstants.DEFAULT_LOCALES` and ensure
`getDefaultI18nBundles()` picks it up alongside the existing default locale(s).
Use the existing `es_ES` export in `translations/index.ts` and the
`DEFAULT_LOCALES` constant in `TranslationBundleConstants` to keep the runtime
defaults aligned.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 62aaca51-495f-4985-abf9-a98a75ee5607
📒 Files selected for processing (4)
.changeset/spanish-translation-bundle.mdCONTRIBUTING.mdpackages/i18n/src/translations/es-ES.tspackages/i18n/src/translations/index.ts
| 'elements.fields.first_name.placeholder': 'Ingresa tu nombre', | ||
| 'elements.fields.last_name.label': 'Apellido', | ||
| 'elements.fields.last_name.placeholder': 'Ingresa tu apellido', | ||
| 'elements.fields.email.label': 'Email', |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Translate the email field label.
This key still renders English text in the Spanish locale, so forms will show a mixed-language label. Change it to a Spanish label such as Correo electrónico.
Suggested fix
- 'elements.fields.email.label': 'Email',
+ 'elements.fields.email.label': 'Correo electrónico',📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 'elements.fields.email.label': 'Email', | |
| 'elements.fields.email.label': 'Correo electrónico', |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/i18n/src/translations/es-ES.ts` at line 59, The Spanish translation
in es-ES still uses the English label for the elements.fields.email.label key,
causing mixed-language UI text. Update the translation entry in the es-ES locale
file to a Spanish label such as “Correo electrónico”, keeping the same key so
the translations lookup continues to work correctly.
| export { default as es_ES } from './es-ES'; | ||
| export { default as en_US } from './en-US'; | ||
| export { default as fr_FR } from './fr-FR'; | ||
| export { default as te_IN } from './te-IN'; | ||
| export { default as hi_IN } from './hi-IN'; | ||
| export { default as pt_BR } from './pt-BR'; | ||
| export { default as pt_PT } from './pt-PT'; | ||
| export { default as ta_IN } from './ta-IN'; | ||
| export { default as si_LK } from './si-LK'; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -n "DEFAULT_LOCALES|es-ES|es_ES" \
packages/i18n/src/constants/TranslationBundleConstants.ts \
packages/i18n/src/translations/index.ts \
packages/i18n/src/utils/getDefaultI18nBundles.tsRepository: asgardeo/javascript
Length of output: 698
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n--- packages/i18n/src/constants/TranslationBundleConstants.ts ---\n'
sed -n '1,120p' packages/i18n/src/constants/TranslationBundleConstants.ts
printf '\n--- packages/i18n/src/utils/getDefaultI18nBundles.ts ---\n'
sed -n '1,140p' packages/i18n/src/utils/getDefaultI18nBundles.ts
printf '\n--- packages/i18n/src/translations/index.ts ---\n'
sed -n '1,80p' packages/i18n/src/translations/index.tsRepository: asgardeo/javascript
Length of output: 4696
Add es-ES to TranslationBundleConstants.DEFAULT_LOCALES
packages/i18n/src/translations/index.ts exports es_ES, but getDefaultI18nBundles() only loads locales listed in TranslationBundleConstants.DEFAULT_LOCALES (currently just en-US), so es-ES won’t be included in the runtime defaults.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/i18n/src/translations/index.ts` around lines 19 - 27, `es_ES` is
exported from the translations index but not loaded by the default bundle list,
so add `es-ES` to `TranslationBundleConstants.DEFAULT_LOCALES` and ensure
`getDefaultI18nBundles()` picks it up alongside the existing default locale(s).
Use the existing `es_ES` export in `translations/index.ts` and the
`DEFAULT_LOCALES` constant in `TranslationBundleConstants` to keep the runtime
defaults aligned.
Purpose
Previously, the Asgardeo JavaScript SDK did not have support for Spanish (Español - es-ES). Users who prefered Spanish would not have been able see UI components translated, limiting accessibility for Spanish-speaking users.
This PR addresses this barrier and now customers who prefer Spanish will be able to see UI components translated and easily navigate through other UI components for each readability and use.
Related PRs/Issues
Changes
es-ES.tsfile for Spanish translationindex.tsthe export value to make Spanish translations importable across SDKspanish-translation-bundle.mdchangeset to trigger a minor @asgardeo/i18n version bumpCONTRIBUTING.mddoc to showcase documentation caveats encountered in building and testing.Testing
Checklist
Security checks
Summary by CodeRabbit
New Features
Documentation