# Culture & Localized Formatting

Source: https://lumeo.nativ.sh/docs/culture

# Culture & Localized Formatting

Dates, numbers, currency and exports respect CultureInfo.CurrentCulture out of the box. Override per-component when you need to.

## How it works

Every Lumeo component that renders a date or a number (DataGrid cells, DatePicker, DateTimePicker, NumberInput, Slider, Statistic, DataGrid exports …) formats its output with `CultureInfo.CurrentCulture` by default. That means ASP.NET's request-localization middleware drives the look of dates and numbers with zero extra wiring — a `de-DE` user sees `15.03.2026` and `1.234,56 €`, an `en-US` user sees `3/15/2026` and `$1,234.56`.

## Wiring ASP.NET request localization

In `Program.cs`, configure the supported cultures and add the middleware — this is the standard ASP.NET Core pattern and nothing in Lumeo is required beyond it:

builder.Services.Configure<RequestLocalizationOptions>(opts => { var supported = new\[\] { "en-US", "de-DE", "fr-FR" }; opts.SetDefaultCulture(supported\[0\]) .AddSupportedCultures(supported) .AddSupportedUICultures(supported); }); var app = builder.Build(); app.UseRequestLocalization();

## Overriding per component

Every component listed below exposes a `Culture` parameter that wins over `CurrentCulture`. This is useful when the app locale and the UI locale differ — e.g. render a German-formatted KPI inside an English admin console.

@using System.Globalization <DataGrid TItem="Invoice" Items="\_invoices" Columns="\_columns" Culture="@\_de" /> <DatePicker @bind-Value="\_date" Culture="@\_de" /> <NumberInput @bind-Value="\_amount" Culture="@\_de" /> <Statistic Title="Revenue" Value="1234.56" Precision="2" Culture="@\_de" /> @code { private readonly CultureInfo \_de = CultureInfo.GetCultureInfo("de-DE"); }

Components honouring the `Culture` parameter today: `DataGrid`, `DatePicker`, `DateTimePicker`, `NumberInput`, `Slider`, `Statistic`.

## Culture in exports

`IDataGridExportService.ToCsv / ToExcel / ToPdf` all accept an optional `CultureInfo`. The DataGrid passes its effective culture automatically, so the downloaded CSV, `.xlsx`, and PDF match what the user sees on screen.

@inject IDataGridExportService Export var bytes = Export.ToExcel(items, exportColumns, sheetName: "Invoices", culture: CultureInfo.GetCultureInfo("de-DE")); await Export.DownloadAsync(bytes, "invoices.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

ClosedXML writes native date / number cells with a format string — Excel then renders them using the workbook locale when the file is opened. Lumeo picks sensible defaults based on the supplied culture's `ShortDatePattern` and `ShortTimePattern`.

## Formatting vs. translated UI text

**Culture** controls how _values_ render (dates, numbers, currency). **Localization** controls how _UI chrome text_ renders (buttons, placeholders, empty-state copy). They are two separate axes — you can ship an app with English UI that still formats numbers as `1.234,56` for a German user.

UI text translation lives in `ILumeoLocalizer` (registered by `AddLumeo()`). Lumeo ships English and German strings out of the box — add or override any key via the `AddLumeo(opts => …)` overload.
