Hello,

Problem/Motivation

I realized that the inline_quote ckeditor5 plugin label is not localized after a customer requested that the tooltip "Inline quote" should be translated in the website language.
For instance, my website is in french, so the plugin tooltip should display "Citation en ligne" instead of "Inline quote".

Although it is no big deal since it has no impact on the functionality itself, I believe it would be a nice add-on to enhance the user experience.

Proposed resolution

Since the plugin is using CKEditor t() function already, it would be quite easy to add support for a few translations since there is an automatic discovery of CKEditor plugin translations (see https://www.drupal.org/node/3264983).

Adding a dependency to core/ckeditor5.translations library to inline_quote library and creating the files /js/build/translations/{my_language}.js seems to be enough to solve it.

I'm attaching a patch with the feature request and a few language translations.

Remaining tasks

Add more languages support.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

misterdidi created an issue. See original summary.

misterdidi’s picture

mably made their first commit to this issue’s fork.

mably’s picture

Wondering if using Drupal.t() couldn't be a better solution here... (MR 6).

Anyway, I updated the MR to parse the plugin javascript code and automatically create the translation files using the contributed <lang>.po files.

mably’s picture

Version: 1.0.0 » 1.x-dev
Status: Active » Needs review

@misterdidi tell me if it works for you and which solution you prefer.

misterdidi’s picture

Status: Needs review » Reviewed & tested by the community

@mably, thanks for the quick reply and the MRs.

Tested both solutions and both of them work well!
Although the Drupal.t() solution is more straightforward, I'd rather stick to the "lang" folder solution to keep it consistent with the way plugins and translations are defined in CKEditor5.

mably’s picture

@misterdidi ok, let's merge MR 5 then.

But what if a user wants to override a translation bundled with our plugin. How can it be done?

misterdidi’s picture

But what if a user wants to override a translation bundled with our plugin. How can it be done?

That's the problem, no CKeditor plugin translation can be overriden in Drupal back-office. :-/

I guess that's why you came up with MR 5 and MR 6 :

  • MR 5 is consistent with the way CKEditor plugins and their translations are defined but does not allow to override the plugin translation.
  • MR 6 is inconsistent but allows users to override the CKeditor plugin translation in Drupal back-office.

I'll leave it to you to decide whether to merge MR 5 or MR 6. As mentioned, I tested both and both work. I only favored the "CKEditor way" for consistency.

  • mably committed 7f4fcf3f on 1.x
    Issue #3556621 by misterdidi, mably: Make plugin translatable
    
mably’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

mably’s picture

Thanks @misterdidi.

Fix included in 1.1.0-rc1 release.

misterdidi’s picture

Great, thank you !

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.