sibiraj-s / ngx-editor

🖋️ Rich Text Editor for angular using ProseMirror
https://sibiraj-s.github.io/ngx-editor/
MIT License
424 stars 183 forks source link

[Feature request]: Support multiple languages #451

Closed gregarega1993 closed 10 months ago

gregarega1993 commented 1 year ago

Proposal

In the docs it says that if you want to use a different text for buttons in the editor you can configure it like this:

NgxEditorModule.forRoot({ locals: { bold: 'Bold', italic: 'Italic', code: 'Code', underline: 'Underline', // ... }, });

But what about if I want to support multiple languages and have a language switch in my app?

Willing to submit a PR?

None

sibiraj-s commented 1 year ago

Sorry for the delay in response. I missed this issue

Can you see if this helps https://github.com/sibiraj-s/ngx-editor/issues/354#issuecomment-878009003?

doug0102 commented 1 year ago

You can find an example here using ngx-translate.

In the example it will not automatically update when you change the language in ngx-translate. To fix that you will have to subscribe to the language change then provide it with the translated locals through the NgxEditorService.

onLangChange(): void { this.ngxEditorService.config.locals = { bold: translateService.instant('editor.bold'), etc... }; }

sibiraj-s commented 10 months ago

Fixed in https://github.com/sibiraj-s/ngx-editor/pull/466.

github-actions[bot] commented 9 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in the thread.