Locale
One of the user's preferred languages, most preferred first.
Verwendung
Choose distance units from the user's preferred locale.
// Choose distance units from the user's preferred locale.
import { localization, type Locale } from 'kuito';
export function distanceLabel(meters: number) {
const locale: Locale | undefined = localization.locales.value[0];
return locale?.measurementSystem === 'us'
? `${(meters / 1609.344).toFixed(1)} mi`
: `${(meters / 1000).toFixed(1)} km`;
}Typdeklaration
export type Locale = LocaleInfo;Mitglieder 11
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
languageTag | string | Ja | BCP 47, as pt-PT or zh-Hant-TW. |
languageCode | string | Ja | — |
languageScriptCode | string | Ja | — |
regionCode | string | Ja | — |
textDirection | TextDirection | Ja | — |
decimalSeparator | string | Ja | — |
digitGroupingSeparator | string | Ja | — |
measurementSystem | MeasurementSystem | Ja | — |
currencyCode | string | Ja | — |
currencySymbol | string | Ja | — |
temperatureUnit | TemperatureUnit | Ja | — |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.