🔤 Language File Support
ContentBuilder.js supports interface translation through language files. This allows you to display the editor UI in different languages.
Provided Language Files
The package includes the following language files:
contentbuilder/lang/en.js
contentbuilder/lang/fr.js
You can create your own language file by copying and modifying an existing one, then translating the values accordingly.
Enabling a Language
To enable a language, include the corresponding language file before loading contentbuilder.min.js:
<script src="contentbuilder/lang/fr.js" type="text/javascript"></script>
Using with React/Vue/Modern Frameworks
If you're using a frontend framework, you can import and pass the language object directly during initialization.
First, create your language file (e.g. locales/en.js) like this:
const _txt = new Array();
_txt["Bold"] = "Bold";
_txt["Italic"] = "Italic";
// ...
export default _txt;
Then import it into your project and assign it when creating the ContentBuilder instance:
import texts from '../Locales/fr';
builder = new ContentBuilder({
container: '.container',
lang: texts
});
With this system, you can easily localize the entire ContentBuilder.js interface to match your users' preferred language.