diff --git a/geshifield/src/Plugin/Field/FieldType/GeshiFieldItem.php b/geshifield/src/Plugin/Field/FieldType/GeshiFieldItem.php
index f7e3407..18ae529 100644
--- a/geshifield/src/Plugin/Field/FieldType/GeshiFieldItem.php
+++ b/geshifield/src/Plugin/Field/FieldType/GeshiFieldItem.php
@@ -49,10 +49,10 @@ class GeshiFieldItem extends FieldItemBase {
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['sourcecode'] = DataDefinition::create('string')
- ->setLabel(t('Source code'));
+ ->setLabel($this->t('Source code'));
$properties['language'] = DataDefinition::create('string')
- ->setLabel(t('Syntax highlighting mode'));
+ ->setLabel($this->t('Syntax highlighting mode'));
return $properties;
}
diff --git a/geshifield/src/Plugin/Field/FieldWidget/GeshiFieldDefaultWidget.php b/geshifield/src/Plugin/Field/FieldWidget/GeshiFieldDefaultWidget.php
index 68d89d1..2fd157e 100644
--- a/geshifield/src/Plugin/Field/FieldWidget/GeshiFieldDefaultWidget.php
+++ b/geshifield/src/Plugin/Field/FieldWidget/GeshiFieldDefaultWidget.php
@@ -27,12 +27,12 @@ class GeshiFieldDefaultWidget extends WidgetBase {
$enabled_languages = GeshiFilter::getEnabledLanguages();
$element['sourcecode'] = array(
- '#title' => t('Code'),
+ '#title' => $this->t('Code'),
'#type' => 'textarea',
'#default_value' => isset($items[$delta]->sourcecode) ? $items[$delta]->sourcecode : NULL,
);
$element['language'] = array(
- '#title' => t('Language'),
+ '#title' => $this->t('Language'),
'#type' => 'select',
'#default_value' => isset($items[$delta]->language) ? $items[$delta]->language : NULL,
'#options' => $enabled_languages,
diff --git a/geshifield/src/Tests/GeshiFieldTest.php b/geshifield/src/Tests/GeshiFieldTest.php
index 6f0efb8..969ba5e 100644
--- a/geshifield/src/Tests/GeshiFieldTest.php
+++ b/geshifield/src/Tests/GeshiFieldTest.php
@@ -101,8 +101,8 @@ class GeshiFieldTest extends WebTestBase {
foreach ($filters as $filter) {
$edit['filters[' . $filter . '][status]'] = TRUE;
}
- $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
- $this->assertRaw(t('Added text format %format.', array('%format' => $edit['name'])), 'New filter created.');
+ $this->drupalPostForm('admin/config/content/formats/add', $edit, $this->t('Save configuration'));
+ $this->assertRaw($this->t('Added text format %format.', array('%format' => $edit['name'])), 'New filter created.');
$this->drupalGet('admin/config/content/formats');
}
diff --git a/src/Controller/GeshiFilterConflicts.php b/src/Controller/GeshiFilterConflicts.php
index 49cbca8..35e13af 100644
--- a/src/Controller/GeshiFilterConflicts.php
+++ b/src/Controller/GeshiFilterConflicts.php
@@ -18,7 +18,7 @@ class GeshiFilterConflicts extends ControllerBase {
if (count($conflicts) == 0) {
$build = array(
'#type' => 'markup',
- '#markup' => t('No conflicts found.'),
+ '#markup' => $this->t('No conflicts found.'),
);
return $build;
}
diff --git a/src/Form/GeshiFilterLanguagesForm.php b/src/Form/GeshiFilterLanguagesForm.php
index 26e7fe9..dea9e2c 100644
--- a/src/Form/GeshiFilterLanguagesForm.php
+++ b/src/Form/GeshiFilterLanguagesForm.php
@@ -102,7 +102,7 @@ class GeshiFilterLanguagesForm extends ConfigFormBase {
foreach ($tags2 as $tag2) {
if ($tag1 == $tag2) {
$name = "language[{$language2}][tags]";
- $form_state->setErrorByName($name, t('The language tags should differ between languages and from the generic tags.'));
+ $form_state->setErrorByName($name, $this->t('The language tags should differ between languages and from the generic tags.'));
}
}
}
@@ -161,8 +161,8 @@ class GeshiFilterLanguagesForm extends ConfigFormBase {
$config = $this->config('geshifilter.settings');
$form = array();
$header = array(
- t('Language'),
- t('GeSHi language code'),
+ $this->t('Language'),
+ $this->t('GeSHi language code'),
);
if ($add_tag_option) {
$header[] = $this->t('Tag/language attribute value');
diff --git a/src/Form/GeshiFilterSettingsForm.php b/src/Form/GeshiFilterSettingsForm.php
index ea2f8a9..ddbf3a9 100644
--- a/src/Form/GeshiFilterSettingsForm.php
+++ b/src/Form/GeshiFilterSettingsForm.php
@@ -51,7 +51,7 @@ class GeshiFilterSettingsForm extends ConfigFormBase {
// library).
$form['library'] = array(
'#type' => 'fieldset',
- '#title' => defined('GESHI_VERSION') ? t('GeSHi library version @version detected', array('@version' => GESHI_VERSION)) : $this->t('GeSHi library'),
+ '#title' => defined('GESHI_VERSION') ? $this->t('GeSHi library version @version detected', array('@version' => GESHI_VERSION)) : $this->t('GeSHi library'),
'#description' => $this->t('The GeSHi filter requires the GeSHi library (which needs to be @downloaded and installed seperately).', array(
'@downloaded' => \Drupal::l($this->t('downloaded'), Url::fromUri('http://qbnz.com/highlighter/')),
)),
diff --git a/src/GeshiFilterCss.php b/src/GeshiFilterCss.php
index aea559c..dd1152b 100644
--- a/src/GeshiFilterCss.php
+++ b/src/GeshiFilterCss.php
@@ -79,7 +79,7 @@ class GeshiFilterCss {
}
}
else {
- drupal_set_message(t('Error while generating CSS rules: could not load GeSHi library.'), 'error');
+ drupal_set_message($this->t('Error while generating CSS rules: could not load GeSHi library.'), 'error');
}
return $output;
}
diff --git a/src/Plugin/Filter/GeshiFilterFilter.php b/src/Plugin/Filter/GeshiFilterFilter.php
index 19a12c9..9673392 100644
--- a/src/Plugin/Filter/GeshiFilterFilter.php
+++ b/src/Plugin/Filter/GeshiFilterFilter.php
@@ -208,7 +208,7 @@ class GeshiFilterFilter extends FilterBase {
$tag_style_examples[] = '' . SafeMarkup::checkPlain('[[foo]]') . '';
}
if (!$bracket_open) {
- drupal_set_message(t('Could not determine a valid tag style for GeSHi filtering.'), 'error');
+ drupal_set_message($this->t('Could not determine a valid tag style for GeSHi filtering.'), 'error');
$bracket_open = SafeMarkup::checkPlain('<');
$bracket_close = SafeMarkup::checkPlain('>');
}
@@ -237,7 +237,7 @@ class GeshiFilterFilter extends FilterBase {
'@lang' => $languages[$tag_to_lang[$tag]],
));
}
- $items[] = '
' . t('Defaults:') . '
'; + $output .= '' . $this->t('Defaults:') . '
'; $items = array(); $default_highlighting = $this->config->get('default_highlighting'); switch ($default_highlighting) { case GeshiFilter::DEFAULT_DONOTHING: - $description = t("when no language attribute is specified the code + $description = $this->t("when no language attribute is specified the code block won't be processed by the GeSHi filter"); break; case GeshiFilter::DEFAULT_PLAINTEXT: - $description = t('when no language attribute is specified, no syntax + $description = $this->t('when no language attribute is specified, no syntax highlighting will be done'); break; default: - $description = t('the default language used for syntax highlighting is + $description = $this->t('the default language used for syntax highlighting is "%default_lang"', array('%default_lang' => $default_highlighting)); break; } - $items[] = t('Default highlighting mode for generic syntax highlighting + $items[] = $this->t('Default highlighting mode for generic syntax highlighting tags: @description.', array('@description' => $description)); $default_line_numbering = $this->config->get('default_line_numbering'); switch ($default_line_numbering) { @@ -364,13 +364,13 @@ class GeshiFilterFilter extends FilterBase { foreach ($language_tags as $tag) { $tags[] = '' . $bracket_open . SafeMarkup::checkPlain($tag) . $bracket_close . '';
}
- $output = t('You can enable syntax highlighting of source code with the following tags: @tags.', array('@tags' => Markup::create(implode(', ', $tags))));
+ $output = $this->t('You can enable syntax highlighting of source code with the following tags: @tags.', array('@tags' => Markup::create(implode(', ', $tags))));
// Tag style options.
if (count($tag_style_examples) > 1) {
- $output .= ' ' . t('The supported tag styles are: @tag_styles.', array('@tag_styles' => Markup::create(implode(', ', $tag_style_examples))));
+ $output .= ' ' . $this->t('The supported tag styles are: @tag_styles.', array('@tag_styles' => Markup::create(implode(', ', $tag_style_examples))));
}
if (in_array(GeshiFilter::BRACKETS_PHPBLOCK, $tag_styles)) {
- $output .= ' ' . t('PHP source code can also be enclosed in <?php ... ?> or <% ... %>.');
+ $output .= ' ' . $this->t('PHP source code can also be enclosed in <?php ... ?> or <% ... %>.');
}
}
return $output;
@@ -452,7 +452,7 @@ class GeshiFilterFilter extends FilterBase {
foreach ($tags2 as $tag2) {
if ($tag1 == $tag2) {
$name = "language[{$language2}][tags]";
- $form_state->setErrorByName($name, t('The language tags should differ between
+ $form_state->setErrorByName($name, $this->t('The language tags should differ between
languages and from the generic tags.'));
}
}
@@ -573,7 +573,7 @@ class GeshiFilterFilter extends FilterBase {
$this->t('GeSHi language code'),
);
if ($add_tag_option) {
- $header[] = t('Tag/language attribute value');
+ $header[] = $this->t('Tag/language attribute value');
}
$form['language'] = array(
'#type' => 'table',
diff --git a/src/Tests/GeshiFilterAdministrationTest.php b/src/Tests/GeshiFilterAdministrationTest.php
index ddfbe1c..439f4ae 100644
--- a/src/Tests/GeshiFilterAdministrationTest.php
+++ b/src/Tests/GeshiFilterAdministrationTest.php
@@ -102,14 +102,14 @@ class GeshiFilterAdministrationTest extends WebTestBase {
'language[php][tags]' => 'php languagetag',
'language[python][tags]' => 'languagetag python',
);
- $this->drupalPostForm('admin/config/content/formats/geshifilter/languages/all', $form_values, t('Save configuration'));
+ $this->drupalPostForm('admin/config/content/formats/geshifilter/languages/all', $form_values, $this->t('Save configuration'));
$this->assertText($this->t('The language tags should differ between languages and from the generic tags.'), $this->t('Language tags should differ between languages (with generic tag options)'));
// Second round: with format specific tag options.
// $this->config->set('use_format_specific_options', TRUE);
// $this->drupalPostForm
// ('admin/config/content/formats/manage/geshifilter_text_format', array(),
- // t('Save configuration'));
+ // $this->t('Save configuration'));
/*$this->config->set('tags_' . $this->input_format_id,
'code blockcode generictag');
// A language tag should differ from the generic tags.
@@ -118,9 +118,9 @@ class GeshiFilterAdministrationTest extends WebTestBase {
'php generictag');
$this->drupalPostForm('admin/config/content/formats/' .
$this->input_format_id
- . '/configure', $form_values, t('Save configuration'));
- $this->assertText(t('The language tags should differ between languages
- and from the generic tags.'), t('Language tags should differ from
+ . '/configure', $form_values, $this->t('Save configuration'));
+ $this->assertText($this->t('The language tags should differ between languages
+ and from the generic tags.'), $this->t('Language tags should differ from
(with format specific tag options)'));
// Language tags should differ between languages.
$form_values = array(
@@ -131,10 +131,10 @@ class GeshiFilterAdministrationTest extends WebTestBase {
);
$this->drupalPostForm('admin/config/content/formats/' .
$this->input_format_id .
- '/configure', $form_values, t('Save configuration'));
- $this->assertText(t('The language tags should differ between languages
+ '/configure', $form_values, $this->t('Save configuration'));
+ $this->assertText($this->t('The language tags should differ between languages
and from the
- generic tags.'), t('Language tags should differ between languages (with
+ generic tags.'), $this->t('Language tags should differ between languages (with
format specific tag options)'));*/
}
@@ -154,8 +154,8 @@ class GeshiFilterAdministrationTest extends WebTestBase {
foreach ($filters as $filter) {
$edit['filters[' . $filter . '][status]'] = TRUE;
}
- $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
- $this->assertRaw(t('Added text format %format.', array('%format' => $edit['name'])), 'New filter created.');
+ $this->drupalPostForm('admin/config/content/formats/add', $edit, $this->t('Save configuration'));
+ $this->assertRaw($this->t('Added text format %format.', array('%format' => $edit['name'])), 'New filter created.');
$this->drupalGet('admin/config/content/formats');
}
@@ -166,7 +166,7 @@ class GeshiFilterAdministrationTest extends WebTestBase {
$edit = array();
$edit['language[xml][enabled]'] = TRUE;
$edit['language[xml][tags]'] = "' . $source_code . '',
array(array($source_code, 'cpp', 0, 1, FALSE)),
- t('Checking type="..." argument'));
+ $this->t('Checking type="..." argument'));
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, 'cpp', 0, 1, FALSE)),
- t('Checking lang="..." argument'));
+ $this->t('Checking lang="..." argument'));
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, 'cpp', 0, 1, FALSE)),
- t('Checking language="..." argument'));
+ $this->t('Checking language="..." argument'));
// Check some languages.
$languages = array('c', 'cpp', 'java');
foreach ($languages as $lang) {
$this->assertGeshiFilterHighlighting('' .
$source_code . '', array(array($source_code, $lang, 0, 1, FALSE)),
- t('Checking language="@lang"', array('@lang' => $lang)));
+ $this->t('Checking language="@lang"', array('@lang' => $lang)));
}
// Check line_numbering argument.
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, 'cpp', 0, 1, FALSE)),
- t('Checking linenumbers="off" argument'));
+ $this->t('Checking linenumbers="off" argument'));
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, 'cpp', 1, 1, FALSE)),
- t('Checking linenumbers="normal" argument'));
+ $this->t('Checking linenumbers="normal" argument'));
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, 'cpp', 1, 27, FALSE)),
- t('Checking start="27" argument'));
+ $this->t('Checking start="27" argument'));
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, 'cpp', 5, 1, FALSE)),
- t('Checking linenumbers="fancy" argument'));
+ $this->t('Checking linenumbers="fancy" argument'));
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, 'cpp', 3, 1, FALSE)),
- t('Checking fancy="3" argument'));
+ $this->t('Checking fancy="3" argument'));
}
/**
@@ -245,17 +245,17 @@ class GeshiFilterTest extends WebTestBase {
// This should be filtered.
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, 'cpp', 0, 1, FALSE)),
- t('Checking angle brackets style in GeshiFilter::BRACKETS_ANGLE mode'));
+ $this->t('Checking angle brackets style in GeshiFilter::BRACKETS_ANGLE mode'));
// This should not be filtered.
$this->assertGeshiFilterHighlighting('[code language="cpp"]' . $source_code . '[/code]',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking [foo] brackets style in GeshiFilter::BRACKETS_ANGLE mode'));
+ $this->t('Checking [foo] brackets style in GeshiFilter::BRACKETS_ANGLE mode'));
$this->assertGeshiFilterHighlighting('[[code language="cpp"]]' . $source_code . '[[/code]]',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking [[foo]] brackets style in GeshiFilter::BRACKETS_ANGLE mode'));
+ $this->t('Checking [[foo]] brackets style in GeshiFilter::BRACKETS_ANGLE mode'));
$this->assertGeshiFilterHighlighting('',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking php code blocks in GeshiFilter::BRACKETS_ANGLE mode'));
+ $this->t('Checking php code blocks in GeshiFilter::BRACKETS_ANGLE mode'));
}
/**
@@ -273,17 +273,17 @@ class GeshiFilterTest extends WebTestBase {
// This should be filtered.
$this->assertGeshiFilterHighlighting('[code language="cpp"]' . $source_code . '[/code]',
array(array($source_code, 'cpp', 0, 1, FALSE)),
- t('Checking [foo] brackets style in GeshiFilter::BRACKETS_SQUARE mode'));
+ $this->t('Checking [foo] brackets style in GeshiFilter::BRACKETS_SQUARE mode'));
// This should not be filtered.
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking angle brackets style in GeshiFilter::BRACKETS_SQUARE mode'));
+ $this->t('Checking angle brackets style in GeshiFilter::BRACKETS_SQUARE mode'));
$this->assertGeshiFilterHighlighting('[[code language="cpp"]]' . $source_code . '[[/code]]',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking [[foo]] brackets style in GeshiFilter::BRACKETS_SQUARE mode'));
+ $this->t('Checking [[foo]] brackets style in GeshiFilter::BRACKETS_SQUARE mode'));
$this->assertGeshiFilterHighlighting('',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking php code blocks in GeshiFilter::BRACKETS_SQUARE mode'));
+ $this->t('Checking php code blocks in GeshiFilter::BRACKETS_SQUARE mode'));
}
/**
@@ -302,17 +302,17 @@ class GeshiFilterTest extends WebTestBase {
// This should be filtered.
$this->assertGeshiFilterHighlighting('[[code language="cpp"]]' . $source_code . '[[/code]]',
array(array($source_code, 'cpp', 0, 1, FALSE)),
- t('Checking [[foo]] brackets style in GeshiFilter::BRACKETS_DOUBLESQUARE mode'));
+ $this->t('Checking [[foo]] brackets style in GeshiFilter::BRACKETS_DOUBLESQUARE mode'));
// This should not be filtered.
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking angle brackets style in GeshiFilter::BRACKETS_DOUBLESQUARE mode'));
+ $this->t('Checking angle brackets style in GeshiFilter::BRACKETS_DOUBLESQUARE mode'));
$this->assertGeshiFilterHighlighting('[code language="cpp"]' . $source_code . '[/code]',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking [foo] brackets style in GeshiFilter::BRACKETS_DOUBLESQUARE mode'));
+ $this->t('Checking [foo] brackets style in GeshiFilter::BRACKETS_DOUBLESQUARE mode'));
$this->assertGeshiFilterHighlighting('',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking php code blocks in GeshiFilter::BRACKETS_DOUBLESQUARE mode'));
+ $this->t('Checking php code blocks in GeshiFilter::BRACKETS_DOUBLESQUARE mode'));
}
/**
@@ -331,17 +331,17 @@ class GeshiFilterTest extends WebTestBase {
// This should be filtered.
$this->assertGeshiFilterHighlighting('',
array(array($source_code, 'php', 0, 1, FALSE)),
- t('Checking php code blocks in GeshiFilter::BRACKETS_PHPBLOCK mode'));
+ $this->t('Checking php code blocks in GeshiFilter::BRACKETS_PHPBLOCK mode'));
// This should not be filtered.
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking angle brackets style in GeshiFilter::BRACKETS_PHPBLOCK mode'));
+ $this->t('Checking angle brackets style in GeshiFilter::BRACKETS_PHPBLOCK mode'));
$this->assertGeshiFilterHighlighting('[code language="cpp"]' . $source_code . '[/code]',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking [foo] brackets style in GeshiFilter::BRACKETS_PHPBLOCK mode'));
+ $this->t('Checking [foo] brackets style in GeshiFilter::BRACKETS_PHPBLOCK mode'));
$this->assertGeshiFilterHighlighting('[[code language="cpp"]]' . $source_code . '[[/code]]',
array(array($source_code, NULL, 0, 1, FALSE)),
- t('Checking [[foo]] brackets style in GeshiFilter::BRACKETS_PHPBLOCK mode'));
+ $this->t('Checking [[foo]] brackets style in GeshiFilter::BRACKETS_PHPBLOCK mode'));
}
/**
@@ -361,10 +361,10 @@ class GeshiFilterTest extends WebTestBase {
// Test the tags.
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array('' . $source_code . '', FALSE, 0, 1, FALSE)),
- t('Do nothing mode should not touch given source code')
+ $this->t('Do nothing mode should not touch given source code')
);
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array($source_code, 'cpp', 0, 1, FALSE)),
- t('Highlighting with language="cpp" should work when default is "do nothing"')
+ $this->t('Highlighting with language="cpp" should work when default is "do nothing"')
);
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array('geshifilter-title', FALSE, 0, 0, 0)),
- t('Setting the title attritbute on code block.'),
+ $this->t('Setting the title attritbute on code block.'),
TRUE
);
// Title set.
@@ -439,7 +439,7 @@ class GeshiFilterTest extends WebTestBase {
0,
),
),
- t('Setting the title attritbute on code block.')
+ $this->t('Setting the title attritbute on code block.')
);
}
@@ -451,7 +451,7 @@ class GeshiFilterTest extends WebTestBase {
// No title set.
$this->assertGeshiFilterHighlighting('' . $source_code . '',
array(array('', FALSE, 0, 0, 0)),
- t('Setting the title attritbute on inline code.')
+ $this->t('Setting the title attritbute on inline code.')
);
// Title set.
$this->assertGeshiFilterHighlighting('' . $source_code . '',
@@ -464,7 +464,7 @@ class GeshiFilterTest extends WebTestBase {
0,
),
),
- t('Setting the title attritbute on inline code.')
+ $this->t('Setting the title attritbute on inline code.')
);
}
@@ -483,10 +483,10 @@ class GeshiFilterTest extends WebTestBase {
// This should be filtered.
$this->assertGeshiFilterHighlighting('[code]' . $source_code . '[/code]',
array(array($source_code, 'text', 0, 1, FALSE)),
- t('Checking if [code][section]...[/code] works'));
+ $this->t('Checking if [code][section]...[/code] works'));
$this->assertGeshiFilterHighlighting('[code language="ini"]' . $source_code . '[/code]',
array(array($source_code, 'ini', 0, 1, FALSE)),
- t('Checking if [code language="ini"][section]...[/code] works'));
+ $this->t('Checking if [code language="ini"][section]...[/code] works'));
}
/**