Skip to content

Conversation

@fairlighteth
Copy link
Contributor

@fairlighteth fairlighteth commented Nov 26, 2025

Summary

High-level description of what your changes are accomplishing

  • Move locale display-name overrides to libs/common-const/src/locales.ts so selectors reuse a single source.
  • MenuBar language dropdown now uses LOCALE_DISPLAY_NAMES to show English (US), Español (España), Русский (Россия).

Before -> After

Screenshot 2025-11-26 at 11 34 01Screenshot 2025-11-26 at 11 42 24

To Test

  1. Open the language selector in the header.
  • It lists English (US), Español (España), Русский (Россия) (with flags).
  • Switching languages still works and reflects the chosen locale.
  1. If other locales are enabled elsewhere (storybook/embedded widgets), open their language selector.
  • Non-overridden locales still display via Intl.DisplayNames (no regression).

Background

Centralizes locale display labels so any selector uses the same wording and avoids duplicating overrides.

Summary by CodeRabbit

New Features

  • Introduced configurable language display names for the language selector, enabling consistent and centralized presentation of supported languages throughout the application.

Enhancement

  • Language selector now implements an intelligent override lookup system for display names, providing flexibility in language presentation while maintaining full backward compatibility and preserving standard language identification as a reliable fallback.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Nov 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
cowfi Ready Ready Preview Dec 3, 2025 10:20am
explorer-dev Ready Ready Preview Dec 3, 2025 10:20am
swap-dev Ready Ready Preview Dec 3, 2025 10:20am
widget-configurator Ready Ready Preview Dec 3, 2025 10:20am
2 Skipped Deployments
Project Deployment Preview Updated (UTC)
cosmos Ignored Ignored Dec 3, 2025 10:20am
sdk-tools Ignored Ignored Preview Dec 3, 2025 10:20am

@fairlighteth fairlighteth requested review from a team November 26, 2025 11:43
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

Walkthrough

A new constant LOCALE_DISPLAY_NAMES is added to centralize custom locale display names, and the MenuBar component imports this constant to check for locale name overrides before falling back to the default Intl.DisplayNames behavior.

Changes

Cohort / File(s) Summary
Locale display name configuration
libs/common-const/src/locales.ts
Adds new exported constant LOCALE_DISPLAY_NAMES mapping supported locales ('en-US', 'es-ES', 'ru-RU') to custom display names.
MenuBar locale name resolution
libs/ui/src/pure/MenuBar/index.tsx
Imports LOCALE_DISPLAY_NAMES and updates getLanguageName function to check for locale overrides; returns custom display name if available, otherwise falls back to existing Intl.DisplayNames logic.

Sequence Diagram

sequenceDiagram
    actor User
    participant MenuBar as MenuBar Component
    participant getLanguageName as getLanguageName()
    participant LOCALE_DISPLAY_NAMES as LOCALE_DISPLAY_NAMES<br/>(override map)
    participant Intl as Intl.DisplayNames<br/>(fallback)

    User->>MenuBar: Select language
    MenuBar->>getLanguageName: getLanguageName(locale)
    getLanguageName->>LOCALE_DISPLAY_NAMES: Check for override
    alt Override found
        LOCALE_DISPLAY_NAMES-->>getLanguageName: Custom display name
        getLanguageName-->>MenuBar: Custom name
    else No override
        getLanguageName->>Intl: Resolve via Intl.DisplayNames
        Intl-->>getLanguageName: Language name (or fallback)
        getLanguageName-->>MenuBar: Display name
    end
    MenuBar->>User: Show language name
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Straightforward constant addition with no complex logic
  • Simple override lookup pattern in getLanguageName function
  • Minimal risk of introducing bugs; primarily data-driven changes

Possibly related PRs

Suggested reviewers

  • shoom3301
  • alfetopito
  • elena-zh

Poem

🐰 Locales now speak in their finest tongue,
Display names dance where overrides are sung,
From constants clear, the languages appear,
MenuBar whispers what our hearts love to hear! 🌍✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding locale display names for consistent language representation across the codebase.
Description check ✅ Passed The description follows the template with all required sections: Summary (with high-level description and screenshots), To Test (with numbered steps and checkboxes), and Background.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/language-labels

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
libs/ui/src/pure/MenuBar/index.tsx (1)

106-109: Simplify the type assertion.

The type assertion as keyof typeof LOCALE_DISPLAY_NAMES is unnecessary since LOCALE_DISPLAY_NAMES is already typed as Partial<Record<...>>, which allows direct access with any string key (returning string | undefined). The subsequent if (override) check already handles the undefined case.

Apply this diff to simplify:

-  const override = LOCALE_DISPLAY_NAMES[locale as keyof typeof LOCALE_DISPLAY_NAMES]
+  const override = LOCALE_DISPLAY_NAMES[locale]
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb46fa6 and 390562b.

📒 Files selected for processing (2)
  • libs/common-const/src/locales.ts (1 hunks)
  • libs/ui/src/pure/MenuBar/index.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Setup
  • GitHub Check: Cypress
🔇 Additional comments (2)
libs/common-const/src/locales.ts (1)

11-17: LGTM! Clean centralization of locale display names.

The new LOCALE_DISPLAY_NAMES constant provides a single source of truth for custom locale display names. The use of Partial<Record<...>> appropriately allows for optional overrides while maintaining type safety.

libs/ui/src/pure/MenuBar/index.tsx (1)

19-19: LGTM! Correct import for centralized locale names.

@shoom3301
Copy link
Collaborator

@fairlighteth for some reason the selector is not displayed in the preview link for me. Should some feature-flag be enabled?

@fairlighteth
Copy link
Contributor Author

@shoom3301 ah yes, the flag was off on the preview (test) but I enabled it now isInternationalizationEnabled and now I do see it.

Copy link
Collaborator

@shoom3301 shoom3301 left a comment

Choose a reason for hiding this comment

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

Works great

@shoom3301 shoom3301 disabled auto-merge December 3, 2025 11:53
@shoom3301 shoom3301 merged commit b4f5319 into develop Dec 3, 2025
15 checks passed
@shoom3301 shoom3301 deleted the fix/language-labels branch December 3, 2025 11:53
@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants