- Home
- Forum
- JavaScript - EJ 2
- Localization of DocumentEditor and toolbar (DocumentEditorContainer)
Localization of DocumentEditor and toolbar (DocumentEditorContainer)
Good day sirs,
I'm having problems trying to localize the DocumentEditor component using plain JavaScript.
I have loaded in the test page ej2.min.js and material.css.
In order to create the editor and its container I use the following code inside a function (a class really):
this._wordDocEditorContainer = new ej.documenteditor.DocumentEditorContainer();
this._wordDocEditorContainer.appendTo('#wordEditor');
ej.documenteditor.DocumentEditorContainer.Inject(ej.documenteditor.Toolbar);
Then, I open a test document:
this._wordDocEditorContainer.documentEditor.open(JSON.stringify(this._getTestDoc()));
This works ok, so I'm doing things right, up to here at least.
The problem is that I cannot find an example of how to set up localization for these components. I tried setting the .locale property of both DocumentEditor, and DocumentEditorContainer to "es" (for spanish) but not only the UI texts don't change, also the context menu wrecks and all sorts of js errors appear in the browser's console.
What is the correct way to localize these components?
Thank you in advance
Alex
SIGN IN To post a reply.
3 Replies
SM
Suriya Murugan
Syncfusion Team
August 21, 2019 10:45 AM UTC
Hi Alex,
Thank you for contacting the Syncfusion support.
To use spanish locale, DocumentEditor have localization support. You have predefined the text value for your language. Based on the given locale, Text in document editor will get change.
Please check below sample code, we added locale for New text:
|
ej.base.L10n.load({
'es': {
'documenteditorcontainer': {
'New': 'nueva',
'Open': 'abierta',
'Image': 'imagen'
}
}
});
//Documenteditor control rendering starts
var container = new ej.documenteditor.DocumentEditorContainer({
enableToolbar: true,locale: "es"
});
ej.documenteditor.DocumentEditorContainer.Inject(ej.documenteditor.Toolbar); |
You can give the locale in JSON structure. Please refer this link: https://github.com/syncfusion/ej2-locale/blob/master/src/de.json
We have attached the list of locale text in DocumentEditor. You can give the value in spanish language and use it in DocumentEditor.
For further reference check below documentation link, we have changed locale to 'ar-AE'.
Documentation link : https://ej2.syncfusion.com/javascript/documentation/document-editor/r-t-l/
Regards,
Suriya M.
AL
Alejandro
August 21, 2019 05:25 PM UTC
Hello Suriya,
With your help I could localize the DocumentEditor and the container to spanish.
Thank you very much!
Regards,
Alex
SM
Suriya Murugan
Syncfusion Team
August 22, 2019 10:24 AM UTC
Hi Alex,
We are glad to know that the issue is resolved.
Regards,
Suriya M.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
AL Alejandro
- Aug 20, 2019 09:25 PM UTC
- Aug 22, 2019 10:24 AM UTC