Skip to content

Localization

Locales

The currently supported languages and locales are:

  • en - English
  • en-UK - English (UK)
  • en-US - English (US)
  • es - Spanish
  • ca - Catalan/Valencian
  • gl - Galician
  • eu - Basque
  • de - German
  • nl - Dutch
  • da - Danish
  • ar - Arabic
  • fr - French
  • pl - Polish
  • th - Thai
  • ur - Urdu
  • hi - Hindu
  • vi - Vietnamese
  • ta - Tamil
  • it - Italian
  • pt - Portuguese
  • ko - Korean
  • jp - Japanese
  • id - Indonesian
  • zh - Chinese

This list of locales is available in:

ts
import { LOCALES } from "@zurich/dev-utils/code";

The acquisition chain (from more relevant to least) on the locale value is:

  • The instance locale attribute.
  • The lang attribute of the <html> tag.
  • The navigator.language value.

Localized display

We offer some WebComponent that help you with the localization:

Localized inputs

The are some inputs that might be affected for the localization. These are basically the ones related to date, time and numbers. This localization is done by the native <input> element by using the user's OS' or Browser's localization settings. This is done in order to accommodate the input of data to the final user's preferences. Here's the explanation of the standard about the topic and the reasoning for this to be a desirable behavior.

With that said, some of our WebComponents offer the possibility of forcing the localization with some tradeoffs (like not being capable of using the numerical manipulation and having to use the date picker).

Attention!

We recommend not to use force localization for inputs for many reasons. So even when we offer the possibility for satisfying possible use cases, we strongly encourage you to think about the real need of forcing the localization.

NumberInput

We won't localize the NumberInput because of the incompatibilities that this can cause. locale will only affect here the units display.

DateInput

We can check this in DateInput:

This approach doesn't affect the model, but only the display. In Arab, the numeric representation is different:

There are cases that the whole system might be weird:

In Thailand they use the year zero as the year in which the Buddha attained parinibbāna. That's why, in this situation, we need todo a value conversion to other localizations.

The locale will apply to the Calendar too if custom-ui is used (or the system one):

TimeInput

Also for TimeInput, where in this case, localization only makes sense for the 12h format:

Even with seconds:

The localization, in the vast majority of cases, makes only sense if you want to represent a 12h format. Otherwise, the re presentation doesn't change.

Select

In case of using with-search, the texts will use the given locale (or the system one):

Calendar

Uses the provided locale or the one detected:

VerticalStepper

Uses the provided locale or the one detected:

FileInput

...