kolkov / angular-editor

A simple native WYSIWYG editor component for Angular 6 -14+
https://angular-editor.kolkov.ru
MIT License
678 stars 360 forks source link

Support localization of headers (translatability) #304

Open AILazerka opened 4 years ago

AILazerka commented 4 years ago

It would be great to achieve customizable translatability of the titles for a use in products which are localized for different regions to exclude need in manual hacks.

Thanks in advance!

kolkov commented 4 years ago

Yes, we discussed such a possibility, but so far there is no good solution, how it can be get it in the library. Such I understand that the Angular team will work on adding the library localization possibility in the new Ivy library format.

wandu-ar commented 4 years ago

May be can solve it with an input attribute passing a translation object that next we can translate with angular i18n tools ...

For example:

<angular-editor formControlName="htmlContent" [config]="editorConfig" [locales]="{bold: 'Bold', italic; 'Italic' ... }" i18n-locales></angular-editor>

Thanks!

AILazerka commented 4 years ago

Hello @kolkov! I understand. Right now in a project we are in need of using a workaround for making headers appear in German. And personally I can say it looks not that good. From the answer above i18n-locales can be used. We can also use ngx-translate I believe with some fallback default translation. We can reserve JSON section for it like:

{
  ...
  "AngularEditor": {
    ...
  },
  ...
}

or even require separate json files for translations.

And when importing the library we can provide translation loader in the config for the AngularEditor and this loader will be pointing to either general file with the structure above or a separate file with the translations which can be placed in the projects under assets as angular-editor-en.json, angular-editor-de.json and other languages or any completely different name. What do you think?

SiriRavoori commented 3 years ago

Can you update on this implementation of translations(for tool bar) ?

kolkov commented 3 years ago

I was googled from any news about translation, but I'm not tryed to use this ability yet. https://github.com/angular/angular/issues/29536

SiriRavoori commented 3 years ago

Hi,

Thank you for your reply. I have managed translations using JQuery.

Regards, Sireesha Naraharisetti

On Tue, 13 Jul 2021, 23:14 Andrey Kolkov, @.***> wrote:

I was googled from any news about translation, but I'm not tryed to use this ability yet. angular/angular#29536 https://github.com/angular/angular/issues/29536

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kolkov/angular-editor/issues/304#issuecomment-879278761, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMN4KTI3EPK2DKE2VGUELYDTXR3OLANCNFSM4S7BY5LQ .

mannyluccio commented 1 year ago

@SiriRavoori Any advice on how you handled it with jquery?