Can labels be changed to a different language?

The Pintura Image Editor module exports the en_gb locale files. Locale files for other languages are included in the product package locale folder.

When using the default factories like openDefaultEditor the english locale is automatically loaded.

Overwriting label captions

We can overwrite labels by passing locale properties like shown below.

import { openDefaultEditor } from './pintura.js';

// set locale to the editor
    src: './my-image.jpeg',
    locale: {
        labelButtonExport: 'Save',

Importing language and locale objects

When using openEditor we have to supply locale property so the editor has labels.

We can set our own labels by updating label properties in the locale objects or by duplicating the locale files and translating the label values there.

import {

    // the core locale object

    // the crop locale object

    // the markup editor locale object
} from './pintura.js';

const locale = {

locale.labelButtonExport = 'Save';

// set locale to the editor
    src: './my-image.jpeg',

Loading different language and locale files

We can use one of the other locale files by importing the needed modules.

In the example below we load the German locale files for the core editor and annotation plugin.

import { openEditor } from './pintura.js';

// note that the MarkupEditor locale is exported by the core locale file
import locale_de_DE, {
    MarkupEditor as locale_markup_editor_de_DE,
} from './locale/de_DE/core/de_DE.js';

// each plugin has a separate locale file
import locale_annotate_de_DE from './locale/de_DE/annotate/de_DE.js';

const locale = {

    src: 'my-image.jpeg',