The theme's language file for saving all of the text used in the theme. The file is especially useful in multilingual online stores.

The language file can be found in the default theme's file /scripts/locales.js.

Texts used in the theme should be saved in the language file in all necessary languages.

The default theme's language file contains, for instance, texts for the modal panel buttons and notifications.

The language file contains only one function – get(text), which is used for retrieving text from the file based on its code:

MCF.Locales.get("textCode");

You can save the retrieved text in a variable or print it directly for display, such as in a notification displayed by using the notifications.js plugin.

If you wish, you can also save texts from the online store's dictionary in the language file:

$.extend(window.MCF.locale.fi, {
    avain1: "{\%Avain1}",
    avain2: "{\%Avain2}"
});

In the example, texts are retrieved by using the {Text} tag's short syntax. The retrieved entries are added to the language file by using the jQuery extend() function.

Dictionary entries can be added to the language file only after the locales.js file has loaded. Make sure that the file has loaded before adding new dictionary contents to it.

Additionally, any text that has been added from the dictionary into the language file is retrieved by using the get(text) function.