/** * Tests that CKEditor plugins participate in JS translation. */ function testJSTranslation() { $this->enableModules(array('language', 'locale')); $this->installSchema('locale', 'locales_source'); $this->installSchema('locale', 'locales_location'); $editor = entity_load('editor', 'filtered_html'); $this->ckeditor->getJSSettings($editor); $localeStorage = $this->container->get('locale.storage'); $string = $localeStorage->findString(array('source' => 'Edit Link', 'context' => '')); $this->assertTrue(!empty($string), 'String from JavaScript file saved.'); }
/** * Assert that CKEditor picks the expected language when French is default. * * @param string $langcode * Language code to assert for. Defaults to French. That is the default * language set in this assertion. */ protected function assertCKEditorLanguage($langcode = 'fr') { // Set French as the site default language. ConfigurableLanguage::createFromLangcode('fr')->save(); $this->config('system.site')->set('default_langcode', 'fr')->save(); // Reset the language manager so new negotiations attempts will fall back on // French. Reinject the language manager CKEditor to use the current one. $this->container->get('language_manager')->reset(); $this->ckeditor = $this->container->get('plugin.manager.editor')->createInstance('ckeditor'); // Test that we now get the expected language. $editor = Editor::load('filtered_html'); $settings = $this->ckeditor->getJSSettings($editor); $this->assertEqual($settings['language'], $langcode); }