You are here

function i18n_Blocks_Test::i18nTranslateBlock in Internationalization 6

Translate block fields to all languages

1 call to i18n_Blocks_Test::i18nTranslateBlock()
i18n_Blocks_Test::testBlockTranslation in tests/i18n_blocks.test

File

tests/i18n_blocks.test, line 92

Class

i18n_Blocks_Test

Code

function i18nTranslateBlock($module, $delta, $fields = array(
  'title',
  'body',
)) {
  foreach ($this
    ->getOtherLanguages() as $language) {
    foreach ($fields as $key) {
      $text[$key] = $this
        ->i18nstringsCreateTranslation("blocks:{$module}:{$delta}:{$key}", $language->language);
    }

    // Now check translated strings display on page
    $this
      ->i18nGet($language->language, '');
    foreach ($text as $string) {
      $this
        ->assertText($string);
    }
    $translations[$language->language] = $text;
  }
  return $translations;
}