返回介绍

Localize TinyMCE

发布于 2019-05-06 06:50:21 字数 2368 浏览 913 评论 0 收藏 0

TinyMCE makes your project accessible to the world through its simple localization framework.

This section demonstrates how to change TinyMCE’s user interface to the user’s language preference. These settings change the language in the toolbar, menu items, buttons, and tooltips.

Pro tip: Language settings can be controlled in these configuration options: directionality, language and language_url. There is also a Directionality plugin that adds a toolbar button to control ltr-rtl behavior.

Step 1

Go to the language download page to review a list of language packs available for TinyMCE.

Click the download link on the far right of the table for a single language. Check the box beside each language and then click the download button at the bottom of the table for multiple languages.

Important: The TinyMCE community translation project provides the language packs on our language download page.

Step 2

Unpack the language js file(s) into the path/to/tinymce/langs/ folder.

Important: The language settings will not work unless the language pack is placed in langs/ directory. The language_url configuration option is another method to enable additional language settings.

Step 3

Set the language option in TinyMCE’s configuration to the language code in the list on this page.

Step 4

Load TinyMCE to confirm that the language is set correctly.

A working example

The following code snippet sets TinyMCE’s language to Chinese and the text directionality from right to left.

Download the Chinese language pack to test this functionality. Install a local instance of TinyMCE from the downloads page. Follow the self-hosted install instructions.

<!DOCTYPE html>
<html>
<head>
  <script src="js/tinymce.min.js"></script>
  <script type="text/javascript">
  tinymce.init({
    selector: 'textarea',
    language: 'zh_CN',
    directionality: 'rtl'
  });
  </script>
</head>

<body>
  <form method="post">
    <textarea>你好,世界!</textarea>
  </form>
</body>
</html>
Next System requirements

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文