Class sap.ui.core.ConfigurationModule: sap/ui/core/Configuration

extends Object

Collects and stores the configuration of the current environment.

The Configuration is initialized once when the sap.ui.core.Core is created. There are different ways to set the environment configuration (in ascending priority):

  1. System defined defaults
  2. Server wide defaults, read from /sap-ui-config.json
  3. Properties of the global configuration object window["sap-ui-config"]
  4. A configuration string in the data-sap-ui-config attribute of the bootstrap tag
  5. Individual data-sap-ui-xyz attributes of the bootstrap tag
  6. Using URL parameters
  7. Setters in this Configuration object (only for some parameters)

That is, attributes of the DOM reference override the system defaults, URL parameters override the DOM attributes (where empty URL parameters set the parameter back to its system default). Calling setters at runtime will override any previous settings calculated during object creation.

The naming convention for parameters is:

  • in the URL : sap-ui-PARAMETER-NAME="value"
  • in the DOM : data-sap-ui-PARAMETER-NAME="value"
where PARAMETER-NAME is the name of the parameter in lower case.

Values of boolean parameters are case insensitive where "true" and "x" are interpreted as true.

Namespaces & Classes
FormatSettingsEncapsulates configuration settings that are related to data formatting/parsing.
Constructor Summary
new sap.ui.core.Configuration()Creates a new Configuration object.
Method Summary
sap.ui.core.Configuration.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.Configuration with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.core.Configuration.getMetadata()Returns a metadata object for class sap.ui.core.Configuration.
applySettings(mSettings)Applies multiple changes to the configuration at once.
getAccessibility()Returns whether the accessibility mode is used or not
getAnimation()Returns whether the animations are globally used
getAppCacheBuster()Base URLs to AppCacheBuster Etag-Index files
getAppCacheBusterHooks()Object defining the callback hooks for the AppCacheBuster like e.g.
getAppCacheBusterMode()The loading mode (sync|async|batch) of the AppCacheBuster (sync is default)
getAutoAriaBodyRole()Returns whether the framework automatically adds automatically the ARIA role 'application' to the html body or not.
getCompatibilityVersion(sFeature)Returns the used compatibility version for the given feature.
getControllerCodeDeactivated()Return whether the controller code is deactivated.
getDebug()Returns whether the page runs in debug mode
getDesignMode()Return whether the design mode is active or not.
getFiori2Adaptation()Returns whether the Fiori2Adaptation is on
getFormatLocale()Returns the format locale string with language and region code.
getFormatSettings()Returns a configuration object that bundles the format settings of UI5.
getFrameOptions()frameOptions mode (allow/deny/trusted).
getInspect()Returns whether the UI5 control inspector is displayed Has only an effect when the sap-ui-debug module has been loaded
getLanguage()Returns a string that identifies the current language.
getLanguageTag()Returns a BCP47-compliant language tag for the current language.
getLocale()Returns a Locale object for the current language.
getManifestFirst()Flag whether a Component should load the manifest first
getNoDuplicateIds()Returns whether there should be an exception on any duplicate element IDs
getOriginInfo()Returns whether the text origin information is collected
getRootComponent()The name of the root component to start or empty
getRTL()Returns whether the page uses the RTL text direction.
getSAPLogonLanguage()Returns a SAP logon language for the current language.
getSuppressDeactivationOfControllerCode()Return whether the activation of the controller code is suppressed
getTheme()Returns the theme name
getUIDPrefix()Prefix to be used for automatically generated control IDs.
getVersion()Returns the version of the framework.
getWeinreId()WEINRE session ID
getWeinreServer()WEINRE server URL
getWhitelistService()URL of the whitelist service.
setCalendarType(sCalendarType)Sets the new calendar type to be used from now on in locale dependent functionalities (for example, formatting, translation texts, etc.
setFormatLocale(sFormatLocale)Sets a new format locale to be used from now on for retrieving locale specific formatters.
setLanguage(sLanguage, sSAPLogonLanguage?)Sets a new language to be used from now on for language/region dependent functionality (e.g.
setRTL(bRTL)Sets the character orientation mode to be used from now on.
getApplication()The name of the application to start or empty
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.core.Configuration()
Creates a new Configuration object.
Method Detail
sap.ui.core.Configuration.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.core.Configuration with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.Object.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.core.Configuration.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.core.Configuration.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
applySettings(mSettings): sap.ui.core.Configuration
Applies multiple changes to the configuration at once.

If the changed settings contain localization related settings like language or calendarType, then only a single localizationChanged event will be fired. As the framework has to inform all existing components, elements, models etc. about localization changes, using applySettings can significantly reduce the overhead for multiple changes, esp. when they occur after the UI has been created already.

The mSettings can contain any property xyz for which a setter method setXYZ exists in the API of this class. Similarly, values for the format settings API can be provided in a nested object with name formatSettings.

Parameters:
{object}mSettings Configuration options to apply
Apply language, calendarType and several legacy format settings in one call

sap.ui.getCore().getConfiguration().applySettings({ language: 'de', calendarType: sap.ui.core.CalendarType.Gregorian, formatSettings: { legacyDateFormat: '1', legacyTimeFormat: '1', legacyNumberFormat: '1' } });

Since:
1.38.6
Returns:
{sap.ui.core.Configuration} Returns this to allow method chaining
getAccessibility(): boolean
Returns whether the accessibility mode is used or not
Returns:
{boolean} whether the accessibility mode is used or not
getAnimation(): boolean
Returns whether the animations are globally used
Returns:
{boolean} whether the animations are globally used
getAppCacheBuster(): string[]
Base URLs to AppCacheBuster Etag-Index files
Returns:
{string[]} array of base URLs
getAppCacheBusterHooks(): object
Object defining the callback hooks for the AppCacheBuster like e.g. handleURL, onIndexLoad or onIndexLoaded.

Experimental API:Since 1.27.0

Experimental:
Since 1.27.0
Returns:
{object} object containing the callback functions for the AppCacheBuster
getAppCacheBusterMode(): string
The loading mode (sync|async|batch) of the AppCacheBuster (sync is default)

Experimental API:Since 1.12.5

Experimental:
Since 1.12.5
Returns:
{string} sync | async
getAutoAriaBodyRole(): boolean
Returns whether the framework automatically adds automatically the ARIA role 'application' to the html body or not.
Since:
1.27.0
Returns:
{boolean}
getCompatibilityVersion(sFeature): jQuery.sap.Version
Returns the used compatibility version for the given feature.
Parameters:
{string}sFeature the key of desired feature
Returns:
{jQuery.sap.Version} the used compatibility version
getControllerCodeDeactivated(): boolean
Return whether the controller code is deactivated. During design mode the

Experimental API:Since 1.26.4

Experimental:
Since 1.26.4
Since:
1.26.4
Returns:
{boolean} whether the activation of the controller code is suppressed or not
getDebug(): boolean
Returns whether the page runs in debug mode
Returns:
{boolean} whether the page runs in debug mode
getDesignMode(): boolean
Return whether the design mode is active or not.

Experimental API:Since 1.13.2

Experimental:
Since 1.13.2
Since:
1.13.2
Returns:
{boolean} whether the design mode is active or not.
getFiori2Adaptation(): boolean|string
Returns whether the Fiori2Adaptation is on
Returns:
{boolean|string} false - no adaptation, true - full adaptation, comma-separated list - partial adaptation Possible values: style, collapse, title, back, hierarchy
getFormatLocale(): string
Returns the format locale string with language and region code. Falls back to language configuration, in case it has not been explicitly defined.
Returns:
{string} the format locale string with language and country code
Returns a configuration object that bundles the format settings of UI5.
Returns:
{sap.ui.core.Configuration.FormatSettings} A FormatSettings object.
getFrameOptions(): string
frameOptions mode (allow/deny/trusted).
Returns:
{string} frameOptions mode
getInspect(): boolean
Returns whether the UI5 control inspector is displayed Has only an effect when the sap-ui-debug module has been loaded
Returns:
{boolean} whether the UI5 control inspector is displayed
getLanguage(): string
Returns a string that identifies the current language.

The value returned by this methods in most cases corresponds to the exact value that has been configured by the user or application or that has been determined from the user agent settings. It has not been normalized, but has been validated against a relaxed version of BCP47, allowing underscores ('_') instead of the suggested dashes ('-') and not taking the case of letters into account.

The exceptions mentioned above affect languages that have been specified via the URL parameter sap-language. That parameter by definition represents a SAP logon language code ('ABAP language'). Most but not all of these language codes are valid ISO639 two-letter languages and as such are valid BCP47 language tags. For better BCP47 compliance, the framework maps the following non-BCP47 SAP logon codes to a BCP47 substitute:

   "ZH"  -->  "zh-Hans"         // script 'Hans' added to distinguish it from zh-Hant
   "ZF"  -->  "zh-Hant"         // ZF ist not a valid ISO639 code, use the compliant language + script 'Hant'
		 "    "1Q"  -->  "en-US-x-saptrc"  // special language code for supportability (tracing),
                                   represented as en-US with a priate extension
   "2Q"  -->  "en-US-x-sappsd"  // special language code for supportability (pseudo translation),
                                   represented as en-US with a priate extension

For a normalized BCP47 tag, call getLanguageTag or call getLocale to get a Locale object matching the language.

Returns:
{string} Language string as configured
getLanguageTag(): string
Returns a BCP47-compliant language tag for the current language.

The return value of this method is especially useful for an HTTP Accept header.

Returns:
{string} The language tag for the current language, conforming to BCP47
getLocale(): sap.ui.core.Locale
Returns a Locale object for the current language.

The Locale is derived from the language property.

Returns:
{sap.ui.core.Locale} The locale
getManifestFirst(): boolean
Flag whether a Component should load the manifest first
Since:
1.33.0
Returns:
{boolean} true if a Component should load the manifest first
getNoDuplicateIds(): boolean
Returns whether there should be an exception on any duplicate element IDs
Returns:
{boolean} whether there should be an exception on any duplicate element IDs
getOriginInfo(): boolean
Returns whether the text origin information is collected
Returns:
{boolean} whether the text info is collected
getRootComponent(): string
The name of the root component to start or empty

Experimental API:Since 1.15.1

Experimental:
Since 1.15.1
Returns:
{string} name of the root component
getRTL(): boolean
Returns whether the page uses the RTL text direction.

If no mode has been explicitly set (neither true nor false), the mode is derived from the current language setting.

Returns:
{boolean} whether the page uses the RTL text direction
getSAPLogonLanguage(): string
Returns a SAP logon language for the current language.
Returns:
{string} The SAP logon language code for the current language
getSuppressDeactivationOfControllerCode(): boolean
Return whether the activation of the controller code is suppressed

Experimental API:Since 1.13.2

Experimental:
Since 1.13.2
Since:
1.13.2
Returns:
{boolean} whether the activation of the controller code is suppressed or not
getTheme(): string
Returns the theme name
Returns:
{string} the theme name
getUIDPrefix(): string
Prefix to be used for automatically generated control IDs. Default is a double underscore "__".
Returns:
{string} the prefix to be used
getVersion(): jQuery.sap.Version
Returns the version of the framework.

Similar to sap.ui.version.

Returns:
{jQuery.sap.Version} the version
getWeinreId(): string
WEINRE session ID
Returns:
{string} the ID to use for the WEINRE server
getWeinreServer(): string
WEINRE server URL
Returns:
{string} the base URL of the WEINRE server
getWhitelistService(): string
URL of the whitelist service.
Returns:
{string} whitelist service URL
setCalendarType(sCalendarType): sap.ui.core.Configuration
Sets the new calendar type to be used from now on in locale dependent functionalities (for example, formatting, translation texts, etc.).
Parameters:
{sap.ui.core.CalendarType|null}sCalendarType the new calendar type. Set it with null to clear the calendar type and the calendar type is calculated based on the format settings and current locale.
Since:
1.28.6
Returns:
{sap.ui.core.Configuration}this to allow method chaining
setFormatLocale(sFormatLocale): sap.ui.core.Configuration
Sets a new format locale to be used from now on for retrieving locale specific formatters. Modifying this setting does not have an impact on the retrieval of translated texts!

Can either be set to a concrete value (a BCP47 or Java locale compliant language tag) or to null. When set to null (default value) then locale specific formatters are retrieved for the current language.

After changing the format locale, the framework tries to update localization specific parts of the UI. See the documentation of setLanguage for details and restrictions.

Note: When a format locale is set, it has higher priority than a number, date or time format defined with a call to setLegacyNumberFormat, setLegacyDateFormat or setLegacyTimeFormat.

Experimental API:Since 1.11.1 - See documentation of {@link #setLanguage} for restrictions.

Parameters:
{string|null}sFormatLocale the new format locale as a BCP47 compliant language tag; case doesn't matter and underscores can be used instead of dashes to separate components (compatibility with Java Locale IDs)
Experimental:
Since 1.11.1 - See documentation of setLanguage for restrictions.
Exceptions:
{Error} When sFormatLocale is given, but is not a valid BCP47 language tag or Java locale identifier
Returns:
{sap.ui.core.Configuration}this to allow method chaining
setLanguage(sLanguage, sSAPLogonLanguage?): sap.ui.core.Configuration
Sets a new language to be used from now on for language/region dependent functionality (e.g. formatting, data types, translated texts, ...).

When the language can't be interpreted as a BCP47 language (using the relaxed syntax described in getLanguage, an error will be thrown.

When the language has changed, the Core will fire its localizationChanged event.

The framework does not guarantee that already created, language dependent objects will be updated by this call. It therefore remains best practice for applications to switch the language early, e.g. before any language dependent objects are created. Applications that need to support more dynamic changes of the language should listen to the localizationChanged event and adapt all language dependent objects that they use (e.g. by rebuilding their UI).

Currently, the framework notifies the following objects about a change of the localization settings before it fires the localizationChanged event:

  • date and number data types that are used in property bindings or composite bindings in existing Elements, Controls, UIAreas or Components
  • ResourceModels currently assigned to the Core, an UIArea, Component, Element or Control
  • Elements or Controls that implement the onlocalizationChanged hook (note the lowercase 'l' in onlocalizationChanged)

It furthermore derives the RTL mode from the new language, if no explicit RTL mode has been set. If the RTL mode changes, the following additional actions will be taken:

  • the URLs of already loaded library theme files will be changed
  • the dir attribute of the page will be changed to reflect the new mode.
  • all UIAreas will be invalidated (which results in a rendering of the whole UI5 UI)

This method does not accept SAP language codes for sLanguage. Instead, a second parameter sSAPLogonLanguage can be provided with a SAP language code corresponding to the given language. A given value will be returned by the getSAPLogonLanguage method. It is up to the caller to provide a consistent pair of BCP47 language and SAP language code. The SAP language code is only checked to be of length 2 and must consist of letters or digits only.

Experimental API:Since 1.11.1 - See method documentation for restrictions.

Parameters:
{string}sLanguage the new language as a BCP47 compliant language tag; case doesn't matter and underscores can be used instead of dashes to separate components (compatibility with Java Locale IDs)
{string}sSAPLogonLanguage? SAP language code that corresponds to the sLanguage; if a value is specified, future calls to getSAPLogonLanguage will return that value; if no value is specified, the framework will use the ISO639 language part of sLanguage as SAP Logon language.
Experimental:
Since 1.11.1 - See method documentation for restrictions.
Exceptions:
{Error} When sLanguage can't be interpreted as a BCP47 language or when sSAPLanguage is given and can't be interpreted as SAP language code.
Returns:
{sap.ui.core.Configuration}this to allow method chaining
See:
http://scn.sap.com/docs/DOC-14377
Sets the character orientation mode to be used from now on.

Can either be set to a concrete value (true meaning right-to-left, false meaning left-to-right) or to null which means that the character orientation mode should be derived from the current language (incl. region) setting.

After changing the character orientation mode, the framework tries to update localization specific parts of the UI. See the documentation of setLanguage for details and restrictions.

Experimental API:Since 1.11.1 - See documentation of {@link #setLanguage} for restrictions.

Parameters:
{boolean|null}bRTL new character orientation mode or null
Experimental:
Since 1.11.1 - See documentation of setLanguage for restrictions.
Returns:
{sap.ui.core.Configuration}this to allow method chaining
getApplication(): string
The name of the application to start or empty

Experimental API:Since 1.13.2

Deprecated:
Since 1.15.1. Please use the rootComponent configuration option sap.ui.core.Configuration#getRootComponent.
Experimental:
Since 1.13.2
Returns:
{string} name of the application