Angular Common - utils - localization

An object that serves as a namespace for the methods that are used to localize an application.

loadMessages()

Loads DevExtreme messages.

import { loadMessages } from "devextreme/localization"
Parameters:
messages:

Object

The messages to be loaded.

The object passed to this method should have the following structure. The first level keys are locale identifiers, which hold an object consisting of key-value pairs.

JavaScript
{
    "en": {
        "Yes": "Yes",
        "No": "No",
        . . .
    },
    "es": {
        "Yes": "Si",
        "No": "No",
        . . .
    }
}
NOTE
This method should be called only once - at the application's launch. It is necessary to reload the page each time you need to load new messages.

locale()

Gets the current locale identifier.

import { locale } from "devextreme/localization"
Return Value:

String

The identifier.

locale(locale)

Sets the current locale identifier.

import { locale } from "devextreme/localization"
Parameters:
locale:

String

The required locale identifier.

NOTE
This method should be called only once - at the application's launch. It is necessary to reload the page each time you need to set new locale.