You are here

public static function Drupali18nTestCase::i18nstringsSaveTranslation in Internationalization 6

Translate one string into the db

2 calls to Drupali18nTestCase::i18nstringsSaveTranslation()
Drupali18nTestCase::i18nstringsCreateTranslation in tests/drupal_i18n_test_case.php
Create and store one translation into the db
i18n_Blocks_Test::testBlockTranslation in tests/i18n_blocks.test

File

tests/drupal_i18n_test_case.php, line 220

Class

Drupali18nTestCase
Test case for typical Drupal tests.

Code

public static function i18nstringsSaveTranslation($name, $lang, $translation, $update = FALSE) {
  $source = i18nstrings_get_source($name);
  if ($source) {
    if ($update) {
      db_query("UPDATE {locales_target} SET translation = '%s' WHERE lid = %d AND language = '%s'", $translation, $source->lid, $lang);
    }
    else {
      db_query("INSERT INTO {locales_target} (translation, lid, language) VALUES ('%s', %d, '%s')", $translation, $source->lid, $lang);
    }
    return db_affected_rows();
  }
  else {
    return 0;
  }
}