TinyMCE本地化能否使用双字母语言代码‘fr’替代‘fr_FR’?
Great question! The short answer is: yes, it's possible, but you'll need a small tweak since TinyMCE's default French language package uses the full fr_FR locale code. Here are two straightforward ways to make it work:
Option 1: Rename the Language File
TinyMCE matches the language option value exactly to the language file name. By default, the French localization file is named fr_FR.js (or fr_FR.min.js for the minified version).
- Just rename this file to
fr.js(orfr.min.js), keep it in your TinyMCE language directory, then set your config like this:tinymce.init({ language: 'fr' });
TinyMCE will now find and load the French localization using the two-letter code.
Option 2: Map the Code with language_url
If you prefer not to rename the original file, use the language_url option to point directly to the fr_FR.js file while keeping language: 'fr' in your config:
tinymce.init({ language: 'fr', language_url: '/path/to/your/tinymce/langs/fr_FR.js' // Replace with your actual file path });
This tells TinyMCE to load the full locale file even when you specify the two-letter code.
A quick reminder: Make sure you’ve downloaded the French language package first and placed it in a location accessible to your TinyMCE instance—without the actual language file, neither method will work.
内容的提问来源于stack exchange,提问作者Paul R

