Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CKEditorWebpackPlugin to handle context and plurals in translations. #6204

Closed
phaux opened this issue Feb 6, 2020 · 2 comments
Closed
Labels
domain:i18n The issue reports a problem with internalization / translation mechanisms package:utils type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@phaux
Copy link

phaux commented Feb 6, 2020

📝 Provide a description of the improvement

Improve CKEditorWebpackPlugin to handle context and plurals in translations. Right now only regular messages are supported.

Related: #6158

@phaux phaux added the type:improvement This issue reports a possible enhancement of an existing feature. label Feb 6, 2020
@Reinmar Reinmar added this to the backlog milestone Feb 18, 2020
@phaux
Copy link
Author

phaux commented Feb 27, 2020

Overview of the changes

Converting PO to JSON

createDictionaryFromPoFileContent is a function which parses a PO file and outputs JSON. The original implementation creates a simple mapping from msgid to msgstr. The new functionality will support extracting msgctxt and multiple plural forms as well. It's also important to include the content of the "plural-forms" header in the output.

Example extracted JSON:

{
  "PLURAL_FORMS": "nplurals=3; plural=(n == 1) ? 0 : (n < 5) ? 1 : 2",
  "message id": ["localised message", "localised message plural 1", "localised message plural 2"],
  "message context|message id": "localised message"
}

Multiple language translation service

MultipleLanguageTranslationService class will be simplified significantly. It won't replace the message IDs with short IDs anymore. It doesn't even need to look at the source code. The only thing it should do is to include the assets generated from the PO files.

The reasoning behind that was that the full message IDs should compress fairly well when using gzip anyways because they contain a lot of words that are used in the code around them. The other reason was that since we would need to handle the message context as well, the generated short IDs would actually have even more entropy than the original two strings. (e.g.: ct( 'command: add table column', 'table column' ) vs ct( 'zY5x', '2Fg' )) and might even make the compression worse.

@ma2ciek ma2ciek added the domain:i18n The issue reports a problem with internalization / translation mechanisms label Apr 10, 2020
@ma2ciek
Copy link
Contributor

ma2ciek commented Jul 15, 2020

The issue was closed by ckeditor/ckeditor5-dev#614.

@ma2ciek ma2ciek closed this as completed Jul 15, 2020
@ma2ciek ma2ciek removed this from the backlog milestone Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:i18n The issue reports a problem with internalization / translation mechanisms package:utils type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants