function PagerTest::createTranslation

Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/PagerTest.php \Drupal\Tests\views\Functional\Plugin\PagerTest::createTranslation()
  2. 8.9.x core/modules/views/tests/src/Functional/Plugin/PagerTest.php \Drupal\Tests\views\Functional\Plugin\PagerTest::createTranslation()
  3. 10 core/modules/views/tests/src/Functional/Plugin/PagerTest.php \Drupal\Tests\views\Functional\Plugin\PagerTest::createTranslation()

Creates single translation for source string.

1 call to PagerTest::createTranslation()
PagerTest::testPagerLocale in core/modules/views/tests/src/Functional/Plugin/PagerTest.php
Tests translating the pager using locale.

File

core/modules/views/tests/src/Functional/Plugin/PagerTest.php, line 598

Class

PagerTest
Tests the pluggable pager system.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

protected function createTranslation($source, $translation, $langcode) {
    $values = [
        'lid' => $source->lid,
        'language' => $langcode,
        'translation' => $translation,
    ];
    return $this->localeStorage
        ->createTranslation($values)
        ->save();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.