We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Localization of DocumentEditor and toolbar (DocumentEditorContainer)

Thread ID:

Created:

Updated:

Platform:

Replies:

146808 Aug 20,2019 09:25 PM UTC Aug 22,2019 10:24 AM UTC JavaScript - EJ 2 3
loading
Tags: DocumentEditor
Alejandro
Asked On August 20, 2019 09:25 PM UTC

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


Suriya Murugan [Syncfusion]
Replied On 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'.    
    

Regards, 

Suriya M. 


Alejandro
Replied On 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

Suriya Murugan [Syncfusion]
Replied On August 22, 2019 10:24 AM UTC

Hi Alex, 

We are glad to know that the issue is resolved.  

Regards, 

Suriya M. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon