function LocaleFileImportStatus::checkTranslations

Get translations for an array of strings.

Parameters

$strings: An array of strings to translate.

$langcode: The language code of the language to translate to.

3 calls to LocaleFileImportStatus::checkTranslations()
LocaleFileImportStatus::testBulkImport in drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php
Test the basic bulk import functionality.
LocaleFileImportStatus::testBulkImportNotUpdateExisting in drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php
Don't update a pre-existing file.
LocaleFileImportStatus::testBulkImportUpdateExisting in drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php
Update a pre-existing file.

File

drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php, line 64
Definition of Drupal\locale\Tests\LocaleFileImportStatus.

Class

LocaleFileImportStatus
Functional tests for the import of translation files.

Namespace

Drupal\locale\Tests

Code

function checkTranslations($strings, $langcode) {
  foreach ($strings as $source => $translation) {
    $db_translation = db_query('SELECT translation FROM {locales_target} lt INNER JOIN {locales_source} ls ON ls.lid = lt.lid WHERE ls.source = :source AND lt.language = :langcode', array(
      ':source' => $source,
      ':langcode' => $langcode,
    ))
      ->fetchField();
    $this
      ->assertEqual((string) $translation, (string) $db_translation);
  }
}