You are here

public static function i18n_Strings_Test::stringSaveTranslation in Internationalization 6

Translate one string into the db

2 calls to i18n_Strings_Test::stringSaveTranslation()
i18n_Strings_Test::stringCreateTranslation in tests/i18n_strings.test
Create and store one translation into the db
i18n_Strings_Test::testStringsAPI in tests/i18n_strings.test
Test base i18nstrings API

File

tests/i18n_strings.test, line 88

Class

i18n_Strings_Test

Code

public static function stringSaveTranslation($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;
  }
}