ckeditor / ckeditor5-angular

Official CKEditor 5 Angular 5+ component.
https://ckeditor.com/ckeditor-5
Other
202 stars 110 forks source link

Localization does not work as shown in the documentation #433

Closed Saiuke closed 1 month ago

Saiuke commented 1 month ago

I am experiencing issues with implementing internationalization in the editor for our Angular application. We are following the steps outlined here: https://ckeditor.com/docs/ckeditor5/latest/getting-started/installation/angular.html#localization.

Specifically, we have an issue with the following line:

import coreTranslations from 'ckeditor5/translations/sv.js;

It appears that no coreTranslations entity is being exported from that file. What would be the correct way of implementing internationalization for the UI of the editor?

Stack info:

Saiuke commented 1 month ago

I have found a workaround for this issue:

And the translations can be imported like this: import sv from 'node_modules/ckeditor5/dist/translations/sv'

I also had a similar problem trying to import the main CSS file, I was able to import it like this: @import "node_modules/ckeditor5/dist/ckeditor5.css";

Mati365 commented 1 month ago

@Saiuke It looks like it's similar to this issue: https://github.com/ckeditor/ckeditor5-angular/issues/432#issuecomment-2255760804

Witoso commented 1 month ago

@Saiuke could you pass your tsconfig? Could you check if switching to  "moduleResolution": "node16" or "moduleResolution": "nodenext" helps?. These modes have better support for the exports field and are designed to work with the latest features of Node.js, including wildcard exports.

package.json is defined as follows:

"exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/ckeditor5.js"
    },
    "./*": "./dist/*",
    "./browser/*": null,
    "./build/*": "./build/*",
    "./src/*": "./src/*",
    "./package.json": "./package.json"
  },
Witoso commented 1 month ago

Let's keep the discussion in one issue in the main repo ckeditor/ckeditor5#16816

Workarounds can be found in this comment: https://github.com/ckeditor/ckeditor5/issues/16816#issuecomment-2257782083