Commit a5723e3e authored by xjm's avatar xjm

Issue #1993928 by BarisW, Wim Leers, thpoul, effulgentsia, mgifford, Gábor...

Issue #1993928 by BarisW, Wim Leers, thpoul, effulgentsia, mgifford, Gábor Hojtsy, Hanno, Pancho, Bojhan: Language of parts: Introduce a language toolbar button
parent 94d96b40
......@@ -69,6 +69,7 @@ var CKBUILDER_CONFIG = {
'wysiwygarea' : 1,
'indent' : 1,
'indentlist' : 1,
'language' : 1,
'list' : 1,
'magicline' : 1,
'maximize' : 1,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -333,6 +333,27 @@ public static function getStandardLanguageList() {
);
}
/**
* The 6 official languages used at the United Nations.
*
* This list is based on http://www.un.org/en/aboutun/languages.shtml/ and it
* uses the same format as getStandardLanguageList().
*
* @return array
* An array with language codes as keys, and English and native language
* names as values.
*/
public static function getUnitedNationsLanguageList() {
return [
'ar' => ['Arabic', /* Left-to-right marker "‭" */ 'العربية', LanguageInterface::DIRECTION_RTL],
'zh-hans' => ['Chinese, Simplified', '简体中文'],
'en' => ['English', 'English'],
'fr' => ['French', 'Français'],
'ru' => ['Russian', 'Русский'],
'es' => ['Spanish', 'Español'],
];
}
/**
* {@inheritdoc}
*
......
......@@ -22,6 +22,12 @@ drupal.ckeditor.plugins.drupalimagecaption:
dependencies:
- filter/caption
drupal.ckeditor.plugins.language:
version: VERSION
css:
component:
css/plugins/language/ckeditor.language.css: {}
drupal.ckeditor.admin:
version: VERSION
js:
......@@ -72,8 +78,16 @@ drupal.ckeditor.stylescombo.admin:
dependencies:
- core/jquery
- core/drupal
- core/jquery.once
- core/drupal.vertical-tabs
- core/drupalSettings
# Ensure to run after ckeditor/drupal.ckeditor.admin.
- ckeditor/drupal.ckeditor.admin
drupal.ckeditor.language.admin:
version: VERSION
js:
js/ckeditor.language.admin.js: {}
dependencies:
- core/jquery
- core/drupal
- core/drupal.vertical-tabs
......@@ -64,6 +64,13 @@ function ckeditor_ckeditor_css_alter(array &$css, Editor $editor) {
if ($editor->getFilterFormat()->filters('filter_caption')->status) {
$css[] = drupal_get_path('module', 'filter') . '/css/filter.caption.css';
}
// @todo: Remove in https://www.drupal.org/node/2645100.
/** @var \Drupal\ckeditor\CKEditorPluginManager $ckeditor_plugin_manager */
$ckeditor_plugin_manager = \Drupal::service('plugin.manager.ckeditor.plugin');
if (in_array('Language', $ckeditor_plugin_manager->getEnabledButtons($editor))) {
$css[] = drupal_get_path('module', 'ckeditor') . '/css/plugins/language/ckeditor.language.css';
}
}
/**
......
......@@ -33,6 +33,15 @@ editor.settings.ckeditor:
sequence:
type: ckeditor.plugin.[%key]
# Plugin \Drupal\ckeditor\Plugin\CKEditorPlugin\Language
ckeditor.plugin.language:
type: mapping
label: 'Language'
mapping:
language_list:
type: string
label: 'Language list ID'
# Plugin \Drupal\ckeditor\Plugin\ckeditor\plugin\StylesCombo
ckeditor.plugin.stylescombo:
type: mapping
......
(function ($, Drupal) {
'use strict';
/**
* Provides the summary for the "language" plugin settings vertical tab.
*/
Drupal.behaviors.ckeditorLanguageSettingsSummary = {
attach: function () {
$('#edit-editor-settings-plugins-language').drupalSetSummary(function (context) {
return $('#edit-editor-settings-plugins-language-language-list-type option:selected').text();
});
}
};
})(jQuery, Drupal);
This diff is collapsed.
......@@ -135,7 +135,7 @@ public function getDefaultSettings() {
),
),
),
'plugins' => array(),
'plugins' => ['language' => ['language_list' => 'un']],
);
}
......
/**
* @file
* Language: add styling for elements that have a language attribute.
*/
/**
* Show the user that a 'lang' tag has been applied by adding a thin dotted
* border. We also append the value of the tag between brackets, for example:
* '(en)'. Since the html element has a 'lang' attribute too we only target
* elements within the html scope.
*/
html [lang] {
outline: 1px dotted gray;
}
html [lang]:after {
content: " ("attr(lang)")";
font-size: 10px;
color: #666;
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment