I would like to get CKEditor to use the current user interface language in my multilingual website. In the Interface Language configuration there is no "Auto" selection. I have to set the language to a single value. Can we add this?

Comments

TwoD’s picture

Issue tags: -change language, -ckeditor

There are a couple of issues about improving language support in the queue, but to make this effective we'll have to add code which scans each editor library and its plugins to make sure there actually is a full set of translation files for all the languages the editor could switch to. If we don't, the editor would simply crash when an unsupported language gets activated.

You can already implement your own logic for this if you'd like, with the help of hook_wysiwyg_editor_settings_alter().

Something like:

/**
 * Implements hook_wysiwyg_editor_settings_alter().
 */
function mymodule_wysiwyg_editor_settings_alter(&$settings, $context) {
  global $language;
  if ($context['profile']->editor == 'ckeditor') {
    switch ($language->language) {
      // Just a few examples, not sure about the language codes...
      // Let's say we have English and Swedish translations both in Drupal and CKEditor, so just pass on the language code.
      case 'en':
      case 'se':
          $settings['language'] = $language->language;
          break;
      case 'it':  // ...but for Italian we need to use French for some odd reason...
         $settings['language'] = 'fr';
         break;
      default:
            // Not set means the editor falls back to English (unless something else was selected in the editor profile).
    }
  }
}

Will that work for now?

shadysamir’s picture

Thank you. This is exactly what I needed. I don't know why I didn't see this earlier.

Rudi Teschner’s picture

Suggestion works for me too. Thanks. :)