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

feat: tinymce internationalization #7363

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zoran995
Copy link
Collaborator

@zoran995 zoran995 commented Dec 11, 2024

What this PR does

Fixes #7275

Add internationalization support to the TinyMCE editor used in Storybuilder. It follows a similar structure as language overrides. The translation files should be added to languages/tinymce in wwwroot.

Test me

  • define multiple languages in config and enable language configuration
  • download the language file from https://www.tiny.cloud/get-tiny/language-packages/
  • add ${language}.js file to wwwroot/languages/tinymce/${language}.js
  • open story builder and try changing languages

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

@zoran995 zoran995 force-pushed the tinymce-internationalization branch from dd56f8f to 4ca7acf Compare December 11, 2024 12:38

return (
<Editor
key={language}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TinyMCE doesn't support dynamic updates of translations after the editor is initialized, so we need to remount it

@@ -4,6 +4,7 @@ import { Editor } from "@tinymce/tinymce-react";
import PropTypes from "prop-types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import tinymce from "tinymce"; // must import despite being unused
import type { Editor as TinyMCEEditor } from "tinymce";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never understood why tinymce must be imported despite being unused. Can the previous line be removed now that something else is imported from tinymce?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check that, but type imports will be removed in compile time so those new imports doesn't change anything

@zoran995 zoran995 requested a review from ljowen December 19, 2024 16:48
@zoran995 zoran995 force-pushed the tinymce-internationalization branch from 4ca7acf to 0d14c94 Compare February 13, 2025 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TinyEditor is not i18n
2 participants