Skip to content
Types
import type { MessageBundleLocale, MessageBundleLoader, FetchMessageBundle, MessageBundle } from "@arcgis/core/intl/messages.js";

Type definitions

MessageBundleLocale

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0
Type
"ar" | "bg" | "bs" | "ca" | "cs" | "da" | "de" | "el" | "en" | "es" | "et" | "fi" | "fr" | "he" | "hr" | "hu" | "id" | "it" | "ja" | "ko" | "lt" | "lv" | "nb" | "nl" | "no" | "nn" | "pl" | "pt" | "pt-BR" | "pt-PT" | "ro" | "ru" | "sk" | "sl" | "sr" | "sv" | "th" | "tr" | "uk" | "vi" | "zh" | "zh-CN" | "zh-HK" | "zh-TW"

MessageBundleLoader

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.18

A message bundle loader is an object used to load translation strings in the user's locale. It must be registered in intl using registerMessageBundleLoader(). When loading message bundles in the API, the last registered loader is evaluated first.

See also

pattern

Property
Type
string | RegExp
Since
ArcGIS Maps SDK for JavaScript 5.0

Used to check if the loader should be used to load a candidate message bundle.

fetchMessageBundle

Property
Type
FetchMessageBundle
Since
ArcGIS Maps SDK for JavaScript 5.0

Called to load the message bundle if the pattern matches the bundle identifier.

Example
const loader = {
// The loader matches all the bundle identifiers starting with "my-application/"
pattern: "my-application/",
// fetch the JSON file from a `translations` folder
async fetchMessageBundle(bundleId, locale) {
const url = new URL(`/assets/translations/${bundleId}_${locale}.json`, window.location.href);
const response = await fetch(url);
return response.json();
}
};
registerMessageBundleLoader(loader);
// Fetch file `./translations/my-application/MyBundle_en-US.json`
const bundle = await fetchMessageBundle("my-application/translations/MyBundle");

FetchMessageBundle

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.18

The function responsible for fetching a message bundle resource for a particular locale.

See also
Parameters
ParameterTypeDescriptionRequired
bundleId

The identifier of the bundle to localize.

locale

The locale in which to load the bundle.

Returns
Promise<MessageBundle>

Resolves to an object containing the localized message strings.

MessageBundle

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0
Type
any