Skip to main content

Localization

Translate the editor interface into any language, support right-to-left layouts, and override individual UI strings.

import { useRef } from 'react';
import { PexelizeEditor, PexelizeEditorRef } from '@pexelize/react-editor';

function LocalizedEditor() {
const editorRef = useRef<PexelizeEditorRef>(null);

return (
<PexelizeEditor
ref={editorRef}
editorKey="pk_your_key"
editorMode="email"
options={{
locale: 'fr',
textDirection: 'ltr',
translations: {
'toolbar.save': 'Sauvegarder',
'toolbar.preview': 'Aperçu',
'panel.content': 'Contenu',
'panel.settings': 'Paramètres',
},
}}
/>
);
}

RTL support

Set textDirection: 'rtl' to mirror the entire editor layout for right-to-left languages like Arabic and Hebrew. This affects the panel positions, text alignment defaults, and toolbar layout.

Built-in locales

Pexelize includes built-in translations for: en, fr, de, es, pt, it, nl, ar, he, ja, ko, zh. Set the locale option to use them. The translations object overrides individual keys.

Update at runtime

Switch language or direction without reinitializing:

// React
editorRef.current?.editor?.setLocale('de');
editorRef.current?.editor?.setTextDirection('ltr');
editorRef.current?.editor?.setLanguage('de', {
'toolbar.save': 'Speichern',
'toolbar.preview': 'Vorschau',
});

// Vanilla JS
pexelize.setLocale('de');
pexelize.setTextDirection('ltr');
pexelize.setLanguage('de', { 'toolbar.save': 'Speichern' });
Partial overrides

You don't need to provide every translation key. The translations object merges with the built-in locale, so you can override just the strings you want to customize.

Method reference

MethodReturnsDescription
setLocale(locale)voidSwitch to a built-in locale
setLanguage(locale, translations)voidSet locale with custom translation overrides
setTextDirection(dir)voidSet 'ltr' or 'rtl' layout direction

Next steps