Skip to content

Localization

Localization in ArcGIS Maps SDK for Swift ensures that your applications seamlessly adapt to your users’ language and regional preferences. The SDK's support spans across several languages, includes translated strings, date and number formatting, right-to-left (RTL) bidirectional content and customizable language settings for basemaps, portal, and OAuth.

How does localization work with ArcGIS Maps SDK for Swift?

ArcGIS Maps SDK for Swift defaults to your device's current locale. To change the locale, you must change your device settings. If the locale is changed to one of the supported languages, you will see the effect in translated strings, data and number formation, bidirectional content, and localized directions. If your language is not supported, see locale fallback.

While the adaptation of your device's locale is automatic, there are various ways to customize locale settings.

Localization with basemap styles

Basemap styles are customizable with BasemapStyleParameters. You can manually change the language settings on basemap styles to customize label display. BasemapStyleLanguage allows you to set a specific locale for the basemap or select a language strategy. A basemap style language strategy determines how to display localized labels. Strategies can show labels in the same language for different locales around the world or use mixed labels, with the local languages. The BasemapStyleLanguageStrategy enumeration offers four options to display localized languages on a basemap.

CaseEffect
applicationLocaleAttempts to use the system locale language for basemap labels.
defaultUses the default language setting for the BasemapStyle.
globalUses the global language (English) for basemap labels.
localUses local place names for basemap labels.

To specify language preferences on your basemap, create BasemapStyleParameters that specify a BasemapStyleLanguage with either a specific locale or a type of BasemapStyleLanguageStrategy. Then initialize your basemap with the parameters.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
        // Option 1: Creates `BasemapStyleParameters` with language strategy such as the system locale
        let languageParameters = BasemapStyleParameters(language: .strategic(.applicationLocale))

        // OR Option 2: Creates BasemapStyleParameters with a specific locale of choice.
        // let languageParameters = BasemapStyleParameters(language: .specific(.init(identifier: "zh-CN")))

        // Creates a basemap with language parameters.
        let basemap = Basemap(style: .arcGISTopographic, parameters: languageParameters)

Localization in routing services

Routing services will localize labels and directions according to current device lcoale. However, you can explicitly set languages for ClosestFacilityParameters and RouteParameters. The directionsLanguage properties for these API allow you to display the resulting directions in specific languages.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
        // Creates route parameters and sets the directions language to Brazilian Portuguese.
        let closestFacilityParameters = try await closestFacilityTask.makeDefaultParameters()
        closestFacilityParameters.directionsLanguage = "pt-BR"

        // Creates route parameters and sets the directions language to Russian.
        let routeParameters = try await routeTask.makeDefaultParameters()
        routeParameters.directionsLanguage = "ru"

Localization in portals and organizations

Portals and organizations are a large part of ArcGIS and accessing them may involve viewing or updating featured items, among other tasks, all of which can require providing localized content. The locale for these is defaulted to your device's locale but can be configured with Portal.locale.

Similarly, OAuth login page can be localized via OAuthUserConfiguration.locale. If the given locale is not supported by the portal, the OAuth login page will be displayed in the language corresponding to locale set in the portal or organization settings.

Locale-aware API

Some API inherently support localization and cannot be customized. Localization includes displaying translating strings and error messages, formatting numbers and dates appropriately, and generating localized directions. The following API supports localization using the current locale:

Supported languages

ArcGIS Maps SDK for Swift has translation support for the locales listed below. In addition to these languages, date and number formatting is supported for any sub-locales.

  • Arabic (ar)
  • Bosnian (bs)
  • Bulgarian (bg)
  • Catalan (ca)
  • Czech (cs)
  • Danish (da)
  • German (de)
  • Greek (el)
  • English (en)
  • Spanish (es)
  • Estonian (et)
  • Finnish (fi)
  • French (fr)
  • Hebrew (he)
  • Croatian (hr)
  • Hungarian (hu)
  • Indonesian (id)
  • Italian (it)
  • Japanese (ja)
  • Korean (ko)
  • Lithuanian (lt)
  • Latvian (lv)
  • Norwegian Bokmål (nb-NO)
  • Dutch (nl)
  • Polish (pl)
  • Portuguese (pt-BR, pt-PT)
  • Romanian (ro)
  • Russian (ru)
  • Slovak (sk)
  • Slovenian (sl)
  • Serbian (sr)
  • Swedish (sv)
  • Thai (th)
  • Turkish (tr)
  • Ukrainian (uk-UA)
  • Vietnamese (vi)
  • Simplified Chinese (zh-CN, zh-Hans)
  • Traditional Chinese (zh-HK, zh-TW)

Support for right-to-left (RTL)

ArcGIS Maps SDK for Swift provides bidirectional support for supported languages and locales, where applicable. Content and positions with leading and trailing options will be converted to right-to-left for appropriate locales.

Locale fallback

Sub-locales not listed above will get translation strings from their macrolanguages. For example, French Canadian ("fr-CA") will use French ("fr") translation strings, and Mexican Spanish ("es-MX") uses Spanish ("es") translation strings. If there is no supported macrolanguage, the translation strings will fall back to English. Date and number formatting will still use the more specific sub-locale.

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