Commit 6a83671d authored by alexpott's avatar alexpott

Issue #2792077 by thpoul, amit.drupal, shruti1803, Sonal.Sangale, Wim Leers:...

Issue #2792077 by thpoul, amit.drupal, shruti1803, Sonal.Sangale, Wim Leers: Replace usage of t() in plugins with $this->t()
parent aef08f50
......@@ -39,8 +39,8 @@ public function getLibraries(Editor $editor) {
*/
public function getConfig(Editor $editor) {
return array(
'drupalImage_dialogTitleAdd' => t('Insert Image'),
'drupalImage_dialogTitleEdit' => t('Edit Image'),
'drupalImage_dialogTitleAdd' => $this->t('Insert Image'),
'drupalImage_dialogTitleEdit' => $this->t('Edit Image'),
);
}
......@@ -50,7 +50,7 @@ public function getConfig(Editor $editor) {
public function getButtons() {
return array(
'DrupalImage' => array(
'label' => t('Image'),
'label' => $this->t('Image'),
'image' => drupal_get_path('module', 'ckeditor') . '/js/plugins/drupalimage/icons/drupalimage.png',
),
);
......
......@@ -2,7 +2,7 @@
namespace Drupal\ckeditor\Plugin\CKEditorPlugin;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\Plugin\PluginBase;
use Drupal\editor\Entity\Editor;
use Drupal\ckeditor\CKEditorPluginInterface;
use Drupal\ckeditor\CKEditorPluginContextualInterface;
......@@ -57,7 +57,7 @@ public function getConfig(Editor $editor) {
return array(
'image2_captionedClass' => 'caption caption-img',
'image2_alignClasses' => array('align-left', 'align-center', 'align-right'),
'drupalImageCaption_captionPlaceholderText' => t('Enter caption here'),
'drupalImageCaption_captionPlaceholderText' => $this->t('Enter caption here'),
// Only enable those parts of DrupalImageCaption for which the
// corresponding Drupal text filters are enabled.
'drupalImageCaption_captionFilterEnabled' => $format->filters('filter_caption')->status,
......
......@@ -37,8 +37,8 @@ public function getLibraries(Editor $editor) {
*/
public function getConfig(Editor $editor) {
return array(
'drupalLink_dialogTitleAdd' => t('Add Link'),
'drupalLink_dialogTitleEdit' => t('Edit Link'),
'drupalLink_dialogTitleAdd' => $this->t('Add Link'),
'drupalLink_dialogTitleEdit' => $this->t('Edit Link'),
);
}
......@@ -49,11 +49,11 @@ public function getButtons() {
$path = drupal_get_path('module', 'ckeditor') . '/js/plugins/drupallink';
return array(
'DrupalLink' => array(
'label' => t('Link'),
'label' => $this->t('Link'),
'image' => $path . '/icons/drupallink.png',
),
'DrupalUnlink' => array(
'label' => t('Unlink'),
'label' => $this->t('Unlink'),
'image' => $path . '/icons/drupalunlink.png',
),
);
......
......@@ -146,183 +146,183 @@ public function getButtons() {
return array(
// "basicstyles" plugin.
'Bold' => array(
'label' => t('Bold'),
'label' => $this->t('Bold'),
'image_alternative' => $button('bold'),
'image_alternative_rtl' => $button('bold', 'rtl'),
),
'Italic' => array(
'label' => t('Italic'),
'label' => $this->t('Italic'),
'image_alternative' => $button('italic'),
'image_alternative_rtl' => $button('italic', 'rtl'),
),
'Underline' => array(
'label' => t('Underline'),
'label' => $this->t('Underline'),
'image_alternative' => $button('underline'),
'image_alternative_rtl' => $button('underline', 'rtl'),
),
'Strike' => array(
'label' => t('Strike-through'),
'label' => $this->t('Strike-through'),
'image_alternative' => $button('strike'),
'image_alternative_rtl' => $button('strike', 'rtl'),
),
'Superscript' => array(
'label' => t('Superscript'),
'label' => $this->t('Superscript'),
'image_alternative' => $button('super script'),
'image_alternative_rtl' => $button('super script', 'rtl'),
),
'Subscript' => array(
'label' => t('Subscript'),
'label' => $this->t('Subscript'),
'image_alternative' => $button('sub script'),
'image_alternative_rtl' => $button('sub script', 'rtl'),
),
// "removeformat" plugin.
'RemoveFormat' => array(
'label' => t('Remove format'),
'label' => $this->t('Remove format'),
'image_alternative' => $button('remove format'),
'image_alternative_rtl' => $button('remove format', 'rtl'),
),
// "justify" plugin.
'JustifyLeft' => array(
'label' => t('Align left'),
'label' => $this->t('Align left'),
'image_alternative' => $button('justify left'),
'image_alternative_rtl' => $button('justify left', 'rtl'),
),
'JustifyCenter' => array(
'label' => t('Align center'),
'label' => $this->t('Align center'),
'image_alternative' => $button('justify center'),
'image_alternative_rtl' => $button('justify center', 'rtl'),
),
'JustifyRight' => array(
'label' => t('Align right'),
'label' => $this->t('Align right'),
'image_alternative' => $button('justify right'),
'image_alternative_rtl' => $button('justify right', 'rtl'),
),
'JustifyBlock' => array(
'label' => t('Justify'),
'label' => $this->t('Justify'),
'image_alternative' => $button('justify block'),
'image_alternative_rtl' => $button('justify block', 'rtl'),
),
// "list" plugin.
'BulletedList' => array(
'label' => t('Bullet list'),
'label' => $this->t('Bullet list'),
'image_alternative' => $button('bulleted list'),
'image_alternative_rtl' => $button('bulleted list', 'rtl'),
),
'NumberedList' => array(
'label' => t('Numbered list'),
'label' => $this->t('Numbered list'),
'image_alternative' => $button('numbered list'),
'image_alternative_rtl' => $button('numbered list', 'rtl'),
),
// "indent" plugin.
'Outdent' => array(
'label' => t('Outdent'),
'label' => $this->t('Outdent'),
'image_alternative' => $button('outdent'),
'image_alternative_rtl' => $button('outdent', 'rtl'),
),
'Indent' => array(
'label' => t('Indent'),
'label' => $this->t('Indent'),
'image_alternative' => $button('indent'),
'image_alternative_rtl' => $button('indent', 'rtl'),
),
// "undo" plugin.
'Undo' => array(
'label' => t('Undo'),
'label' => $this->t('Undo'),
'image_alternative' => $button('undo'),
'image_alternative_rtl' => $button('undo', 'rtl'),
),
'Redo' => array(
'label' => t('Redo'),
'label' => $this->t('Redo'),
'image_alternative' => $button('redo'),
'image_alternative_rtl' => $button('redo', 'rtl'),
),
// "blockquote" plugin.
'Blockquote' => array(
'label' => t('Blockquote'),
'label' => $this->t('Blockquote'),
'image_alternative' => $button('blockquote'),
'image_alternative_rtl' => $button('blockquote', 'rtl'),
),
// "horizontalrule" plugin
'HorizontalRule' => array(
'label' => t('Horizontal rule'),
'label' => $this->t('Horizontal rule'),
'image_alternative' => $button('horizontal rule'),
'image_alternative_rtl' => $button('horizontal rule', 'rtl'),
),
// "clipboard" plugin.
'Cut' => array(
'label' => t('Cut'),
'label' => $this->t('Cut'),
'image_alternative' => $button('cut'),
'image_alternative_rtl' => $button('cut', 'rtl'),
),
'Copy' => array(
'label' => t('Copy'),
'label' => $this->t('Copy'),
'image_alternative' => $button('copy'),
'image_alternative_rtl' => $button('copy', 'rtl'),
),
'Paste' => array(
'label' => t('Paste'),
'label' => $this->t('Paste'),
'image_alternative' => $button('paste'),
'image_alternative_rtl' => $button('paste', 'rtl'),
),
// "pastetext" plugin.
'PasteText' => array(
'label' => t('Paste Text'),
'label' => $this->t('Paste Text'),
'image_alternative' => $button('paste text'),
'image_alternative_rtl' => $button('paste text', 'rtl'),
),
// "pastefromword" plugin.
'PasteFromWord' => array(
'label' => t('Paste from Word'),
'label' => $this->t('Paste from Word'),
'image_alternative' => $button('paste from word'),
'image_alternative_rtl' => $button('paste from word', 'rtl'),
),
// "specialchar" plugin.
'SpecialChar' => array(
'label' => t('Character map'),
'label' => $this->t('Character map'),
'image_alternative' => $button('special char'),
'image_alternative_rtl' => $button('special char', 'rtl'),
),
'Format' => array(
'label' => t('HTML block format'),
'label' => $this->t('HTML block format'),
'image_alternative' => [
'#type' => 'inline_template',
'#template' => '<a href="#" role="button" aria-label="{{ format_text }}"><span class="ckeditor-button-dropdown">{{ format_text }}<span class="ckeditor-button-arrow"></span></span></a>',
'#context' => [
'format_text' => t('Format'),
'format_text' => $this->t('Format'),
],
],
),
// "table" plugin.
'Table' => array(
'label' => t('Table'),
'label' => $this->t('Table'),
'image_alternative' => $button('table'),
'image_alternative_rtl' => $button('table', 'rtl'),
),
// "showblocks" plugin.
'ShowBlocks' => array(
'label' => t('Show blocks'),
'label' => $this->t('Show blocks'),
'image_alternative' => $button('show blocks'),
'image_alternative_rtl' => $button('show blocks', 'rtl'),
),
// "sourcearea" plugin.
'Source' => array(
'label' => t('Source code'),
'label' => $this->t('Source code'),
'image_alternative' => $button('source'),
'image_alternative_rtl' => $button('source', 'rtl'),
),
// "maximize" plugin.
'Maximize' => array(
'label' => t('Maximize'),
'label' => $this->t('Maximize'),
'image_alternative' => $button('maximize'),
'image_alternative_rtl' => $button('maximize', 'rtl'),
),
// No plugin, separator "button" for toolbar builder UI use only.
'-' => array(
'label' => t('Separator'),
'label' => $this->t('Separator'),
'image_alternative' => [
'#type' => 'inline_template',
'#template' => '<a href="#" role="button" aria-label="{{ button_separator_text }}" class="ckeditor-separator"></a>',
'#context' => [
'button_separator_text' => t('Button separator'),
'button_separator_text' => $this->t('Button separator'),
],
],
'attributes' => array(
......
......@@ -52,12 +52,12 @@ public function getConfig(Editor $editor) {
public function getButtons() {
return array(
'Styles' => array(
'label' => t('Font style'),
'label' => $this->t('Font style'),
'image_alternative' => [
'#type' => 'inline_template',
'#template' => '<a href="#" role="button" aria-label="{{ styles_text }}"><span class="ckeditor-button-dropdown">{{ styles_text }}<span class="ckeditor-button-arrow"></span></span></a>',
'#context' => [
'styles_text' => t('Styles'),
'styles_text' => $this->t('Styles'),
],
],
),
......@@ -76,11 +76,11 @@ public function settingsForm(array $form, FormStateInterface $form_state, Editor
}
$form['styles'] = array(
'#title' => t('Styles'),
'#title' => $this->t('Styles'),
'#title_display' => 'invisible',
'#type' => 'textarea',
'#default_value' => $config['styles'],
'#description' => t('A list of classes that will be provided in the "Styles" dropdown. Enter one or more classes on each line in the format: element.classA.classB|Label. Example: h1.title|Title. Advanced example: h1.fancy.title|Fancy title.<br />These styles should be available in your theme\'s CSS file.'),
'#description' => $this->t('A list of classes that will be provided in the "Styles" dropdown. Enter one or more classes on each line in the format: element.classA.classB|Label. Example: h1.title|Title. Advanced example: h1.fancy.title|Fancy title.<br />These styles should be available in your theme\'s CSS file.'),
'#attached' => array(
'library' => array('ckeditor/drupal.ckeditor.stylescombo.admin'),
),
......@@ -98,12 +98,12 @@ public function settingsForm(array $form, FormStateInterface $form_state, Editor
public function validateStylesValue(array $element, FormStateInterface $form_state) {
$styles_setting = $this->generateStylesSetSetting($element['#value']);
if ($styles_setting === FALSE) {
$form_state->setError($element, t('The provided list of styles is syntactically incorrect.'));
$form_state->setError($element, $this->t('The provided list of styles is syntactically incorrect.'));
}
else {
$style_names = array_map(function ($style) { return $style['name']; }, $styles_setting);
if (count($style_names) !== count(array_unique($style_names))) {
$form_state->setError($element, t('Each style must have a unique label.'));
$form_state->setError($element, $this->t('Each style must have a unique label.'));
}
}
}
......
......@@ -108,23 +108,23 @@ public function getDefaultSettings() {
// Button groups.
array(
array(
'name' => t('Formatting'),
'name' => $this->t('Formatting'),
'items' => array('Bold', 'Italic',),
),
array(
'name' => t('Links'),
'name' => $this->t('Links'),
'items' => array('DrupalLink', 'DrupalUnlink',),
),
array(
'name' => t('Lists'),
'name' => $this->t('Lists'),
'items' => array('BulletedList', 'NumberedList',),
),
array(
'name' => t('Media'),
'name' => $this->t('Media'),
'items' => array('Blockquote', 'DrupalImage',),
),
array(
'name' => t('Tools'),
'name' => $this->t('Tools'),
'items' => array('Source',),
),
),
......@@ -160,7 +160,7 @@ public function settingsForm(array $form, FormStateInterface $form_state, Editor
$form['toolbar']['button_groups'] = array(
'#type' => 'textarea',
'#title' => t('Toolbar buttons'),
'#title' => $this->t('Toolbar buttons'),
'#default_value' => json_encode($settings['toolbar']['rows']),
'#attributes' => array('class' => array('ckeditor-toolbar-textarea')),
);
......@@ -168,7 +168,7 @@ public function settingsForm(array $form, FormStateInterface $form_state, Editor
// CKEditor plugin settings, if any.
$form['plugin_settings'] = array(
'#type' => 'vertical_tabs',
'#title' => t('CKEditor plugin settings'),
'#title' => $this->t('CKEditor plugin settings'),
'#attributes' => array(
'id' => 'ckeditor-plugin-settings',
),
......
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