Localization options
content_langs
This feature is only available for TinyMCE 5.9 and later. |
This option sets the languages displayed in the language
toolbar button and the language
menu item. The option accepts an array of language specs. Each language spec is a JavaScript object defined using the following properties.
Name | Type | Requirement | Description |
---|---|---|---|
|
String |
required |
The name shown for this language in the UI. |
|
String |
required |
The language tag, as defined in Tags for Identifying Languages (BCP47), for this language. This language tag is placed in the |
|
String |
optional |
An alternative language tag, that does not need to be compatible with BCP47. This string is placed in the |
There is no default value for the content_langs
option. If no value is specified, the language
toolbar button and menu item are not available. A default value for this option is provided by the Spell Checker Pro plugin. For information on using the content_langs
option with the Spell Checker Pro plugin, see: Spell Checker Pro plugin - content_langs
.
Type: Array
Example: Using content_langs
tinymce.init({
selector: 'textarea', // change this according to your HTML
toolbar: 'language',
content_langs: [
{ title: 'English', code: 'en' },
{ title: 'Spanish', code: 'es' },
{ title: 'French', code: 'fr' },
{ title: 'German', code: 'de' },
{ title: 'Portuguese', code: 'pt' },
{ title: 'Chinese', code: 'zh' }
]
});
directionality
This option allows you to set the base direction of directionally neutral text (i.e., text that doesn’t have inherent directionality as defined in Unicode) within the editor. This is similar to the use of the 'dir'
attribute when using content editable elements by themselves.
Type: String
Default Value: 'ltr'
Possible Values: 'ltr'
, 'rtl'
language
This option specifies the language used for the TinyMCE user interface, such as menu items, dialogs, and tooltips. By default, TinyMCE user interface is set to US English.
Before changing the language option, ensure that the language pack is available to the TinyMCE instance. Tiny provides two collections of language packs:
-
Enterprise language packs - Professionally localized language packs provided on Tiny Cloud and bundled with enterprise self-hosted bundles.
-
Community language packs - Localizations provided by TinyMCE users through Transifex, which need to be downloaded prior to use, from the Tiny Downloads Page - Language Packages.
For information on:
-
Using the enterprise language packs, see: Using the enterprise language packs.
-
Using the community language packs, see: Using the community language packs.
Option: language
Type: String
Default Value: en_US
Example: Using language
In this example we will set the editor language to Swedish.
tinymce.init({
selector: 'textarea', // change this value according to your HTML
language: 'sv_SE'
});
Using the enterprise language packs
The following professionally localized language packs are provided to paid Tiny Cloud and enterprise self-hosted deployments. To use these language packs, set the language
option to the corresponding language code. No additional configuration is required.
Supported Languages
Language | Code |
---|---|
Arabic |
ar |
Basque |
eu |
Bulgarian (Bulgaria) |
bg_BG |
Catalan |
ca |
Chinese (China) |
zh_CN |
Chinese (Taiwan) |
zh_TW |
Croatian |
hr |
Czech |
cs |
Danish |
da |
Dutch |
nl |
Finnish |
fi |
French (France) |
fr_FR |
German |
de |
Greek |
el |
Hebrew (Israel) |
he_IL |
Hungarian (Hungary) |
hu_HU |
Indonesian |
id |
Italian |
it |
Japanese |
ja |
Kazakh |
kk |
Korean (Korea) |
ko_KR |
Norwegian Bokmål (Norway) |
nb_NO |
Persian |
fa |
Polish |
pl |
Portuguese (Brazil) |
pt_BR |
Portuguese (Portugal) |
pt_PT |
Romanian |
ro |
Russian |
ru |
Slovak |
sk |
Slovenian (Slovenia) |
sl_SI |
Spanish |
es |
Spanish (Mexico) |
es_MX |
Swedish (Sweden) |
sv_SE |
Thai (Thailand) |
th_TH |
Turkish |
tr |
Ukrainian |
uk |
Using the community language packs
Tiny recommends using the language_url for the community language packs, to avoid copying the language pack into the tinymce/langs folder every time you upgrade TinyMCE.
|
To use change the user interface language using a community language pack:
-
Download the language pack from the Tiny Community Language Packages download page.
-
Unpack the language file into the
tinymce/langs
folder. -
Set the
language
option in your TinyMCE configuration to the language code, matching the filename on the language pack. For example: If the language pack has the filenamesv_SE.js
, then setlanguage: 'sv_SE'
, -
Confirm that the language has been set successfully by loading TinyMCE.
The language code set in the TinyMCE configuration must match the filename of the language file. If the language file is not found, TinyMCE will not load. |
If a language you need is not available, you may wish to translate it yourself. To contribute to translating TinyMCE, go to our Transifex translation page and sign up, then request to join a team or create a new team if your language are not listed.
language_url
When using the language
option to set the user interface language you may choose to place any language pack(s) in a directory other than the default. If you do this you need to provide a simple URL to where the language file is located. We recommend using a site absolute URL.
Type: String
Example: Using language_url
tinymce.init({
selector: 'textarea', // change this value according to your HTML
language_url : '/languages/fi.js' // site absolute URL
});
You can find and download languages here.