BPT

Language Selector

The BptLanguage component provides a dropdown for selecting culture/language with Unicode flag display. Changes affect all culture-aware components.

Language Parameters
Culture Selector

Select a culture to change formatting across the application:

Compact Display Mode

The compact mode shows only the flag icon, ideal for nav bars and toolbars:

Nav bar preview:

Set DisplayMode="BptLanguageDisplayMode.Compact" for flag-only trigger. Dropdown still shows full details.

Live Currency Formatting

See how currency formatting changes with culture selection:

Formatted: $1,234.56
Formatted: $9,876.54
Number Format Demonstration

Decimal separator and thousands separator vary by culture:

Formatted: 1,234,567.89
Formatted: 0.1234
Culture Comparison Table

Sample formatting for different cultures:

Culture Flag Currency Symbol Sample Amount Decimal Separator
nb-NO🇳🇴krkr 1 234,56Comma (,)
en-GB🇬🇧££1,234.56Period (.)
en-US🇺🇸$$1,234.56Period (.)
Usage Information
Features:
  • Display Modes: Full (flag + name + code) or Compact (flag-only trigger for nav bars)
  • Culture Selection: Dropdown with flag, name, and culture code
  • Global State: Culture persisted in localStorage and BptRootComponent
  • Browser Detection: Auto-detects browser language on first visit, maps to nearest supported culture
  • CultureCode Override: Set CultureCode on BptRootComponent to lock all components to a specific culture
  • Auto-Resolve: Date selectors and numeric inputs automatically use the cascaded culture unless FormatCulture is set explicitly
  • Unicode Flags: Native emoji flags with SVG fallback for cross-platform support
  • Event Callback: OnCultureChanged fires when user selects a culture
  • Auto-Refresh: All BptNumericInput components update formatting automatically
  • DecimalSeparator: Override the culture's default decimal separator character
  • ThousandsSeparator: Override the culture's default thousands separator character
  • Supported Cultures:
    • nb-NO - Norwegian (Norsk) - NOK (kr)
    • en-GB - English (UK) - GBP (£)
    • en-US - English (US) - USD ($)
Current Configuration
📋 [+]
<BptLanguage OnCultureChanged="HandleCultureChanged" />

@code {
    private void HandleCultureChanged(string newCulture)
    {
        Console.WriteLine($"Culture changed to: {newCulture}");
    }
}
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.