Content localization options

Setting the language on content

content_langs

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

title

String

required

The name shown for this language in the UI.

code

String

required

The language tag, as defined in Tags for Identifying Languages (BCP47), for this language. This language tag is placed in the lang attribute for elements formatted using this language.

customCode

String

optional

An alternative language tag, that does not need to be compatible with BCP47. This string is placed in the data-mce-lang attribute for elements formatted using this language, if it is defined.

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' }
  ]
});

Setting the language options for Spell Checker Pro

To set the default language for Spell Checker Pro plugin, see: The Spell Checker Pro plugin - spellchecker_language.

To customize the list of spell checking languages available to your users through the Spell Checker Pro plugin, see: The Spell Checker Pro plugin - spellchecker_languages.

Changing the default text direction of content

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'

Example: using directionality

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  directionality: 'ltr'
});

Allow users to change the text direction of content

To allow your users to change the text direction of content as needed, add the toolbar buttons provided by The Directionality plugin.