Localization

How does localization work with the ArcGIS Maps SDK for JavaScript?

The SDK will automatically use the locale defined via the lang attribute on the root html element, or the locale of the browser. This is used when determining how to format numbers and dates, widget translations, and the default place label language of basemaps from the basemap styles service. If you do not want this behavior, you can specify your application's locale to a specific locale at runtime via the intl.setLocale(locale) method.

1
2
3
4
5
6
7
8
9
10
// Sets the locale to French
intl.setLocale("fr");

// Sets the locale to UK English.
// Dates are formatted in day/month/year order.
intl.setLocale("en-GB");

// Sets the locale to US English.
// Dates are formatted in month/day/year order.
intl.setLocale("en-US");

Please note that setLocale can be called at anytime by an application. Widgets will change to the new locale automatically. This behavior is considered experimental since the SDK is not designed around switching locales at runtime. For example, labels on feature layers, or numbers and dates formatted by Arcade expressions, will not update. It is recommended to call setLocale as soon as possible within the application.

The locale can still be initialized using a global object similar to how it was handled prior to version 4.16.

1
2
3
4
5
6
<script>
  // Set the locale before the SDK loads
  esriConfig = {
    locale: "fr-FR"
  };
</script>

Prior to version 4.16, setting the locale in a Dojo config object was the preferred way. This still works for backwards compatibility but is not recommended going forward.

Please refer to the Intl module - API reference documentation for additional information on SDK localization utilities.

Support for right-to-left (RTL)

The provides bidirectional support. To enable right-to-left (RTL), set the dir attribute in the <html> or <body> tag to rtl.

1
<html dir="rtl">

This will impact many aspects of the SDK, for example:

  • Widget content.
  • Themes.
  • Widget positions specified with leading/trailing options of the UI add/empty/move methods. For left-to-right (LTR), "leading" is left and "trailing" is right. For right-to-left (RTL), "leading" is right and "trailing" is left.

Alternatively, the right-to-left dir attribute may be applied individually on a widget container. Then, only the widget's content is affected:

1
2
3
4
5
6
<body>
  <div id="viewDiv">
    <div id="elevationWidgetDiv" dir="rtl">
    </div>
  </div>
</body>

Locale support

The has support for the following locales.

  • Arabic (ar)
  • Bosnian (bs) - Added in version 4.2
  • Bulgarian (bg) - Added in version 4.22
  • Catalan (ca) - Added in version 4.8
  • Simplified Chinese (zh-cn)
  • Traditional Chinese (Hong Kong) (zh-hk)
  • Traditional Chinese (Taiwan) (zh-tw)
  • Croatian (hr) - Added in version 4.1
  • Czech (cs)
  • Danish (da)
  • Dutch (nl)
  • English (en)
  • Estonian (et)
  • Finnish (fi)
  • French (fr)
  • German (de)
  • Greek (el)
  • Hebrew (he)
  • Hungarian (hu) - Added in version 4.8
  • Indonesian (id) - Added in version 4.2
  • Italian (it)
  • Japanese (ja)
  • Korean (ko)
  • Latvian (lv)
  • Lithuanian (lt)
  • Norwegian (nb)
  • Polish (pl)
  • Portuguese (Brazil) (pt-br)
  • Portuguese (Portugal) (pt-pt)
  • Romanian (ro)
  • Russian (ru)
  • Serbian (sr) - Added in version 4.1
  • Slovak (sk) - Added in version 4.18
  • Slovenian (sl) - Added in version 4.6
  • Spanish (es)
  • Swedish (sv)
  • Thai (th)
  • Turkish (tr)
  • Ukrainian (uk) - Added in version 4.11
  • Vietnamese (vi)

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

The developer dashboard has moved

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close