I18n API

This API provides methods for the Internalization that can be used in plugins.

Available methods

t Performs translation of the passed string depended on the i18n dictionary

t(dictKey: string)

Performs translation with automatically added namespace like tools.${toolName}  or blockTunes.${tuneName}

t(dictKey: string): string;


string String to translate. Actually, the key from the i18n dictionary under the corresponding section.

Return value

string Translated string. The value from the i18n dictionary.


/** * Using in a plugin */ class SimpleImage { constructor({data, api}){ this.api = api; } render(){ const button = document.createElement('button'); button.textContent = this.api.i18n.t('Upload an image'); return button; } } /** * Editor.js initialization * Example of passing i18n dictionary */ new Editorjs({ // ... tools: { image: SimpleImage, }, i18n: { tools: { image: { 'Upload an image': 'Загрузить изображение', } } }, })