Translations of custom toolbar items

Hello,

We have added 2 custom items to the toolbar and we are not able to translate these items with ej2-locale library.


Screenshot 2023-10-09 at 6.35.06 PM.png

in the above snapshot, you can see that all the syncfusion provided toolbar items have been translated into french.


11 Replies

BS Balamurugan Shanmugam Syncfusion Team October 11, 2023 04:37 PM UTC

Hi Sumanth,

We have prepared a sample to meet your requirements.

Sample - Fzrcmu (forked) - StackBlitz

In this sample,

We have added a key with a value-pair object locale for French.

public defaultLocaleObject = {
    InsertField: 'Insérer un champ',
    InsertCondition: 'Insérer une condition',
  };
public localObjL10n = new L10n('documenteditor'this.defaultLocale'fr');

And use the added locale constant in the InsertField and InsertCondition

    {
      prefixIcon: 'sf-icon-InsertMergeField',
      tooltipText: 'Insert Field',
      text: this.onWrapText(this.localObj.getConstant('InsertField')),
      id: 'InsertField',
    },
    {
      prefixIcon: 'sf-icon-FinishMerge',
      tooltipText: 'Insert Condition',
      text: this.onWrapText(this.localObj.getConstant('InsertCondition')),
      id: 'InsertCondition',
    },


Output:



If you are using more than one language, you could refer to the attached sample. Otherwise, you can directly access the text of a custom toolbar item like below:

Code snippet:

    {
      prefixIcon: 'sf-icon-FinishMerge',
      tooltipText: 'Insérer un champ',
      text: onWrapText('Insérer un champ'),
      id: 'InsertField',
    },

Regards,

Balamurugan S



SK Sumanth K S October 19, 2023 05:40 AM UTC

Hello Balamurugan,

Thank you for the update. However, this solution is not working for us as expected. The translation does not happen when we switch the language in the parent component.  we set the "locale" property of documenteditor component when the changeLanguage event is triggered from the parent component.

Image_8161_1697693860138


Image_1857_1697693903864


 Could you please help us with an example of having translations switch between 2 languages?



BS Balamurugan Shanmugam Syncfusion Team October 19, 2023 02:19 PM UTC

Hi Sumanth,

Sorry for the inconvenience. We have attached a modified sample to meet your requirements. Please find the below attached for your reference. And also we have attached a video for your reference.

Sample - Fzrcmu (forked) - StackBlitz

In this sample,

Added button; change locale.

After clicking the button, the locale is changed to French like below.


Again, click and the locale changed to Arabic.


You can see both languages have their own locale in the custom toolbar.


Regards,

Balamurugan S


Attachment: Locale_dc37e5aa.zip


SK Sumanth K S October 20, 2023 06:36 AM UTC

Hello Balamurugan,

Thank you so much for the detailed demo. Much appreciated.

However, there is one more blocking issue with this implementation. The editor content is being reset to empty on setting the locale to the document editor component. The issue can be reproducible in the sample you have attached.

Is there any workaround to avoid this?


Before switching the language.

Image_6167_1697783412043


After switching the language.

Image_8441_1697783677852



BS Balamurugan Shanmugam Syncfusion Team October 25, 2023 03:50 PM UTC

Hi Sumanth,

We can reproduce the reported "Blank document opened while switching locale" issue with the provided details. Currently, we are validating and will get back to you by October 27, 2023.

Regards,

Balamurugan S



BS Balamurugan Shanmugam Syncfusion Team October 30, 2023 08:15 AM UTC

Hi Sumanth,

We need an additional timeline to validate this and will get back to you by November 1, 2023.

Regards,

Balamurugan S



SK Sumanth K S November 2, 2023 04:05 AM UTC

Hello Balamurugan,

Could you please update me on this?

Regards,

-Sumanth K S




SK Sumanth K S November 10, 2023 06:07 AM UTC

Gentle reminder!



SM Suriya Murugan Syncfusion Team November 10, 2023 06:11 AM UTC

Sumanth, we will update details shortly.



SM Suriya Murugan Syncfusion Team November 10, 2023 06:57 AM UTC

Sumanth, 

Currently, the document editor doesn’t provide support for state persistence (when you change locally entire control will rerender and  will remain in the previous state). We have logged this as a feature request and this feature will be included in any of our upcoming releases. You can track the feature status from the below link.    
  
we will update the status of the feedback link once it is taken for implementation. We will update, once implemented. 


SK Sumanth K S November 13, 2023 12:42 PM UTC

Thanks for the update Suriya. 


Loader.
Up arrow icon