Skip to content

Add Spanish localization for the application#51

Open
koteshyelamati wants to merge 3 commits into
Sentriscloud:mainfrom
koteshyelamati:i18n/add-spanish-locale
Open

Add Spanish localization for the application#51
koteshyelamati wants to merge 3 commits into
Sentriscloud:mainfrom
koteshyelamati:i18n/add-spanish-locale

Conversation

@koteshyelamati

@koteshyelamati koteshyelamati commented Jun 14, 2026

Copy link
Copy Markdown

Summary

Adds locales/es.json — a complete Spanish (Español) translation of the explorer UI. All 97 i18n keys from locales/en.json are translated, keeping keys identical and only translating the values.

Closes #50

Test plan

  • Switch language selector to "Español" and verify all nav items, stats labels, feed headings, mempool panel, RWA table columns, block/tx detail fields, wallet buttons, and error messages render in Spanish.
  • Confirm no keys are missing (key count matches en.json).

Related

Follows the same pattern as the existing locales/id.json and locales/zh.json locale files.

Summary by CodeRabbit

  • New Features
    • Spanish language support is now available across the application, including navigation, wallet connect/disconnect, transaction and block details, contracts history, search guidance, developer lab messaging, and system banners.
    • Added Spanish UI text via a new localization file and expanded language selection with Spanish (“Español”), including routing and fallback behavior for missing translations.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@koteshyelamati, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 88aab800-f080-442d-bdf6-606e8386cace

📥 Commits

Reviewing files that changed from the base of the PR and between f8b32f3 and 62b541c.

📒 Files selected for processing (1)
  • src/components/lang_switcher.rs
📝 Walkthrough

Walkthrough

Spanish localization is added through a complete locales/es.json translation catalog. The i18n module now recognizes Spanish in the language enum, locale list, code and label mappings, code parsing, locale loading, and cached translation lookup. Spanish UI coverage includes navigation, status panels, transaction and block details, contracts history, errors, developer lab messaging, wallet states, node reconnect messaging, and language selection.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The Rust i18n wiring goes beyond #50's JSON-only locale contribution scope. Either keep this PR to the locale JSON only or update #50 to explicitly include the Lang/i18n plumbing changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding Spanish localization support.
Description check ✅ Passed The description follows the required Summary, Test plan, and Related sections and references issue #50.
Linked Issues check ✅ Passed The PR adds the Spanish locale with preserved keys and translated values, satisfying #50's core requirement.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
locales/es.json (1)

1-98: ⚠️ Potential issue | 🔴 Critical

Critical: Spanish locale file added but Rust i18n system cannot load or access it.

The locales/es.json file is added in isolation. However, the Rust i18n infrastructure (src/i18n/mod.rs and src/components/lang_switcher.rs) remains unchanged and does not support Spanish. This blocks the locale from being loaded, selected, or used at runtime.

Evidence of incomplete integration:

  1. Lang enum (src/i18n/mod.rs:29-31) defines only En, Id, Zh—no Es variant. Lang::ALL contains exactly 3 items.
  2. Lang::raw() (lines 65-70) uses include_str!() only for en.json, id.json, zh.json—no es.json.
  3. Lang::from_code() (lines 58-63) has only "id" and "zh" cases; all other strings (including "es") fall back to Lang::En: _ => Self::En.
  4. Lang::code(), label(), full_label() (lines 34-56) have no Es match arm, so Spanish has no code, label, or display name.
  5. Static maps (lines 72-74) and map_for() (lines 75-96) define only EN_MAP, ID_MAP, ZH_MAP—no ES_MAP and no Lang::Es case.
  6. LanguageSwitcher (src/components/lang_switcher.rs:12-18) cycles En → Id → Zh → En—no Es case, making Spanish unreachable to users.

Consequence: Even though the JSON file is present, the locale cannot be loaded, selected, or accessed at runtime.

PR claim vs. reality: The PR objectives state the implementation "follows the established pattern used in existing locale files," and the test plan states: "verifying that the language selector can switch to 'Español'". However, neither is achievable without Rust code changes.

Action required: Update src/i18n/mod.rs to:

  • Add Es to the Lang enum.
  • Implement Es case in code()"es", label()"ES", full_label()"Español".
  • Update Lang::from_code() to match "es" => Self::Es.
  • Add include_str!("../../locales/es.json") in Lang::raw() for Es.
  • Add ES_MAP static and handle it in map_for().

Update src/components/lang_switcher.rs to include Es in the cycle: En → Id → Zh → Es → En.

🤖 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 `@locales/es.json` around lines 1 - 98, The Spanish locale JSON file was added
but the Rust i18n system was not updated to support it, making the locale
inaccessible at runtime. Add the `Es` variant to the `Lang` enum and implement
all required methods for it: add the `"es"` case to `Lang::from_code()`,
implement the `code()` method to return `"es"`, implement `label()` to return
`"ES"`, implement `full_label()` to return `"Español"`, include the Spanish JSON
file via `include_str!()` in `Lang::raw()` for the `Es` variant, create an
`ES_MAP` static following the existing pattern of `EN_MAP`, `ID_MAP`, and
`ZH_MAP`, and add the `Lang::Es` case to the `map_for()` method. Additionally,
update the `LanguageSwitcher` component's language cycling logic to include `Es`
in the rotation sequence so users can switch to Spanish through the UI.
🤖 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.

Outside diff comments:
In `@locales/es.json`:
- Around line 1-98: The Spanish locale JSON file was added but the Rust i18n
system was not updated to support it, making the locale inaccessible at runtime.
Add the `Es` variant to the `Lang` enum and implement all required methods for
it: add the `"es"` case to `Lang::from_code()`, implement the `code()` method to
return `"es"`, implement `label()` to return `"ES"`, implement `full_label()` to
return `"Español"`, include the Spanish JSON file via `include_str!()` in
`Lang::raw()` for the `Es` variant, create an `ES_MAP` static following the
existing pattern of `EN_MAP`, `ID_MAP`, and `ZH_MAP`, and add the `Lang::Es`
case to the `map_for()` method. Additionally, update the `LanguageSwitcher`
component's language cycling logic to include `Es` in the rotation sequence so
users can switch to Spanish through the UI.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8f277b9e-a327-405c-bbb6-335f3134c7ad

📥 Commits

Reviewing files that changed from the base of the PR and between 1f74071 and c3e87e6.

📒 Files selected for processing (1)
  • locales/es.json

@satyakwok satyakwok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gracias — the Spanish strings themselves look great (full key parity with en.json, idiomatic). One thing before it can ship: locales/es.json isn't picked up yet on its own. The locale set is enumerated in src/i18n/mod.rs (the Lang enum + code() / from_str() / content() arms, all currently En/Id/Zh), and the LanguageSwitcher cycles a fixed three. To make Spanish selectable, please also:

  • add Es to the Lang enum
  • add the "es" arms to code(), from_str(), and content() (include_str!("../../locales/es.json"))
  • extend LanguageSwitcher so it includes Spanish in the cycle

With those, the es.json you added wires up. Thanks for adding the locale!

@koteshyelamati

Copy link
Copy Markdown
Author

Thanks @satyakwok! Right, the es.json isn't wired up on its own. I'll add Es to the Lang enum, add the "es" arms to code(), from_str(), and content() (with include_str!("../../locales/es.json")), and extend LanguageSwitcher to include Spanish in the cycle. Will push shortly.

@koteshyelamati

Copy link
Copy Markdown
Author

@satyakwok pushed — es is now wired up end to end: Es added to the Lang enum and ALL, "es" arms added to code(), label() (ES), full_label() (Español), from_code(), and raw() with include_str!("../../locales/es.json"), plus an ES_MAP OnceLock and the map_for arm. LanguageSwitcher now cycles En → Es → Id → Zh → En, and the module docs reflect the four locales. Ready for another look.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 `@src/i18n/mod.rs`:
- Around line 1-10: Update the LanguageSwitcher cycle in the lang switcher
component so the Lang match includes Spanish in the order En → Es → Id → Zh →
En, and persist the selected locale through the existing persist_lang flow.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e93e2f05-ec2e-4f74-9f3c-ab6a697c0be8

📥 Commits

Reviewing files that changed from the base of the PR and between c3e87e6 and f8b32f3.

📒 Files selected for processing (1)
  • src/i18n/mod.rs

Comment thread src/i18n/mod.rs
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.

Help translate the explorer — add a locale

2 participants