Issue Bug Closed

#100869Base CKEditor configuration prevents editor localization

Andreas Nedbal 05/12/23, 22:45 updated 07/09/24, 12:56

Description

The Default/Minimal/Full.yaml files all include the Editor/Base.yaml file, which sets the following options:

    language:
      # will be overridden by the locale of the backend user
      ui: 'en'
      # will be overridden by the record (if a language is set)
      content: 'en'

However the statements “will be overriden” are not correct, because prepareConfigurationForEditor() contains following code:

        // Set the UI language of the editor if not hard-coded by the existing configuration
        if (empty($configuration['language'])) {
            $userLang = (string)($this->getBackendUser()->user['lang'] ?: 'en');
            $configuration['language']['ui'] = $userLang === 'default' ? 'en' : $userLang;
        } elseif (!is_array($configuration['language'])) {
            $configuration['language'] = [
                'ui' => $configuration['language'],
            ];
        }

Since the language configuration is never empty if we use the Base configuration (which is most cases now), the CKEditor instance doesn’t get passed the backend user locale, causing the UI to always be in English.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.