ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
9.64k stars 3.7k forks source link

Please add docs on how to use local PO files #13324

Open Badlapje opened 1 year ago

Badlapje commented 1 year ago

Origin URL

https://ckeditor.com/docs/ckeditor5/latest/framework/guides/plugins/package-generator/javascript-package.html

Project version

35.4.0

Is the information outdated? How?

No response

Is there something missing in the guide? What is it?

The guide mentions that it's possible to use local PO files. However, it doesn't mention how to actually go about it. It refers to the dedicated translation guide on this point. But that guide only mentions the following:

Note that by default, the CKEditor 5 translations plugin is configured to parse only the CKEditor 5 source code when looking for localizable messages and generating translation assets.

If you develop your own plugin outside the CKEditor 5 ecosystem and localize it by creating PO files, you should override both the sourceFilesPattern and the packageNamePattern options to allow the CKEditor 5 webpack plugin to analyze the code and find messages with corresponding translations. You should also mention these webpack plugin changes in your package README to make other users build the localized CKEditor 5 editor with your plugin correctly. This obstacle may be simplified in the future when the localization feature gets more popular.

It's fun that this at least gives a clue as to what's going on. But ... it doesn't say how to actually solve it. I put all my translation files just like the official plugins do: /lang/translations/... with a context.json in /lang. However, that doesn't mean they're picked up. I also tried /src/lang... but that didn't work either.

Given that the official Javascript package has no webpack.config.js that is very confusing to say the least. Looking for help i found a git issue, where the request was closed not so long ago by @Reinmar with a reference to the package generator ... but again without actually mentioning how to do this when using the package generator.

Is there anything else you would like to add?

Using transifex is a paid service. An expensive one at that. It costs a minimum of 70 € / month. This is an unreasonable burden on people creating third party plugins. Having this translation flow as the default seems to me to discourage people from creating third party plugins.

User agent

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0

Badlapje commented 1 year ago

See also:

Reinmar commented 1 year ago

@Badlapje, just to be sure because you haven't stated that explicitly:

cc @apadol-cksource, our package generator's docs are indeed rather "dry" – just stating list of commands without much of a story and tutorial. One idea could be to review them and try to convert them into more of a tutorial.

Badlapje commented 1 year ago

Hi @Reinmar

I'm indeed trying to translate my own package generated with the package generator (will be opensourced once it's done - it's an iframe plugin). Without relying on Transifex.

I managed to resolve all other issues, but for this one. Once i find out how it's supposed to be done I'd be happy to make a PR to amend the documentation.

Badlapje commented 1 year ago

For reference: this is the plugin in it's embryonic form: https://github.com/FTRPRF/ckeditor5-iframe/pkgs/npm/ckeditor5-iframe

pixel-fabian commented 11 months ago

Are there any news regarding this topic?

@Badlapje Have you found a solution? @Reinmar Is there any more documentation on how to translate custom plugins?

Our scenario is very similar:

Folder Structure:

└──  ckeditor5
  ├── build
  ├── ckeditor5-myplugin
  │  ├── lang
  │  │   └── translations
  │  │       ├── de.po
  │  │       └── en.po
  │  └── src
  ├── src
  ├── package.json
  └── webpack.config.js

The builld of the editor works fine and includes our plugin, except of the translations. We assume, its because of the "CKEditor 5 translations plugin" configuration.

Is there an example on how to modify the config, so it can pickup the local files, as well as the official ones form the npm packages?

Badlapje commented 11 months ago

@pixel-fabian sadly i haven't found a solution yet. For other "plugins" we've basically sidestepped the ck-editor plugin flow by opening a custom modal + form within our platform. This isn't ideal, but it does make it easier to develop extensions for us. It also means we can use the translations in our own platform. Given that this is almost a year old and a rather simple question, we had to work around this problem somehow.

Witoso commented 11 months ago

Linking to #15502. @filipsobol let's keep this scenario in mind.