Skip to content

feat(storefront): SD-11500 render native language names on storefront using Intl.DisplayNames#2607

Merged
bc-yevhenii-buliuk merged 1 commit intobigcommerce:masterfrom
bc-yevhenii-buliuk:SD-11500
Feb 16, 2026
Merged

feat(storefront): SD-11500 render native language names on storefront using Intl.DisplayNames#2607
bc-yevhenii-buliuk merged 1 commit intobigcommerce:masterfrom
bc-yevhenii-buliuk:SD-11500

Conversation

@bc-yevhenii-buliuk
Copy link
Contributor

@bc-yevhenii-buliuk bc-yevhenii-buliuk commented Feb 11, 2026

What?

This PR adds native language name rendering using the browser's Intl.DisplayNames API, eliminating the need for backend language name storage.

Details:
1. Temporary Test Markup
A temporary test markup component (test-lang-selector.html) has been added to visually verify the language name rendering logic. This component is included in navigation.html with a TODO comment and will be removed before merging this PR.

2. Fallback Behavior
If the Intl.DisplayNames API is not supported by the browser or fails for any reason, language codes will be displayed as-is (e.g., 'en', 'es', 'fr'). This graceful degradation ensures the language selector remains functional in older browsers.

3. UI Label Localization
The "Language" label that appears in the UI (e.g., "Language: English") is localized through the existing lang/*.json translation system, not via Intl.DisplayNames.

4. Active Language Formatting
Following the pattern established by the currency selector, the currently active language is wrapped in a <strong> tag for visual emphasis. The JS logic preserves this formatting by updating only the text content within the <strong>
element, leaving the surrounding structure intact.

5. Active Language Code Architecture
To avoid iterating through the languages array to find the active language within the
<a class="navUser-action navUser-action--languageSelector"> element, a new active_locale_code property will be added to the Stencil context in SD-11311. This property will be derived from the is_active key and placed at the same level as the languages array, mirroring the consistent pattern used in the currency selector ( active_currency_code ).

Stencil Context Structure:

{
  "language_selector": {
    "languages": [
      { 
         "code": "en",
         "is_active": true,
          ...
      },
      { 
         "code": "fr",
         "is_active": false,
          ...
      },
      ....
    ],
    "active_locale_code": "en",  // ← New property (SD-11311)
  }
}

Requirements

  • CHANGELOG.md entry added (required for code changes only)

Tickets / Documentation

Screenshots (if appropriate)

sd_11500_feat_lang_name

@jkanive
Copy link
Contributor

jkanive commented Feb 12, 2026

@bc-yevhenii-buliuk Why are languages other than English showing up in lower case?
And secondly, upon selection, we are changing it all to uppercase? Maybe we are doing the same thing for currency code.

@bc-yevhenii-buliuk
Copy link
Contributor Author

bc-yevhenii-buliuk commented Feb 12, 2026

@bc-yevhenii-buliuk Why are languages other than English showing up in lower case? And secondly, upon selection, we are changing it all to uppercase? Maybe we are doing the same thing for currency code.

@jkanive this is the correct native representation according to each language's orthographic rules, e.g.

  • English → capitalized (English grammar rule: language names are capitalized)
  • українська → lowercase (Ukrainian grammar rule: language names are lowercase)

As an option, we could use CSS to maintain native names with consistent capitalization.

Screenshot 2026-02-12 at 14 46 17

@bc-yevhenii-buliuk bc-yevhenii-buliuk merged commit 5442e22 into bigcommerce:master Feb 16, 2026
1 check passed
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.

3 participants

Comments