Globalization in Blazor TimePicker Component

7 Jul 20221 minute to read

Localization

Blazor TimePicker component can be localized. Refer to Blazor Localization topic to localize Syncfusion Blazor components.

Customize the localized text

  • The localized text of particular component can be changed by editing the wwwroot/blazor-locale/src/.json file.

  • In the following code, modified the localized text of placeholder in de culture.

[wwwroot/blazor-locale/src/de.json]

{
  "de": {
    "timepicker": {
      "placeholder": "Wählen Sie Zeit"
    }
  }
}

Customizing Localized Text in Blazor TimePicker

Right-To-Left

The TimePicker supports RTL (right-to-left) functionality for languages like Arabic and Hebrew to display the text in the right-to-left direction. Use the EnableRtl property to set the RTL direction.

The following code example initializes the TimePicker component in Arabic culture.

@using Syncfusion.Blazor.Calendars
@inject HttpClient Http;

<SfTimePicker TValue="DateTime?" Locale="ar" EnableRtl=true></SfTimePicker>

@code {
    [Inject]
    protected IJSRuntime JsRuntime { get; set; }
    protected override async Task OnInitializedAsync()
    {
        this.JsRuntime.Sf().LoadLocaleData(await Http.GetJsonAsync<object>("blazor-locale/src/ar.json")).SetCulture("ar");
    }
}

Right to Left in Blazor TimePicker