Skip to main content

⚙️ Locale API

Koval formatter components support locale prop, which allows setting formatting according to user country standards.

This property accepts a string with a BCP 47 language tag, or an Intl.Locale instance, or an array of such locale identifiers.

locale prop defaults to browser settings.

Examples​

Sweden country name in different locales.

Result
Loading...
Live Editor
//import {NameRegion} from 'koval-ui';

function Example(props) {
  return (
    <div>
      <NameRegion countryCode="SE" locale="en-US" /> <br />
      <NameRegion countryCode="SE" locale="zgh-Tfng-MA" /> <br />
      <NameRegion countryCode="SE" locale="ga-IE" /> <br />
      <NameRegion countryCode="SE" locale="ka-GE" /> <br />
      <NameRegion countryCode="SE" locale="is-IS" /> <br />
      <NameRegion countryCode="SE" locale="uk-UA" /> <br />
    </div>
  );
}