You are here

public static function LingotekConfigSet::saveSegmentTranslation in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekConfigSet.php \LingotekConfigSet::saveSegmentTranslation()

Save segment's translation for the given target

Parameters

int: the lid of the segment being translated

string: the 2-digit language code for the target language

string: the translated content to be saved

File

lib/Drupal/lingotek/LingotekConfigSet.php, line 338
Defines LingotekConfigSet.

Class

LingotekConfigSet
A class wrapper for Lingotek-specific behavior on ConfigSets.

Code

public static function saveSegmentTranslation($lid, $target_language, $content) {

  // insert/update translations, overwriting everything that is there
  // except for the i18n_status field, which should preserve its
  // currently-set flags, and the plid and plural fields which just
  // take default values for now.
  db_merge('locales_target')
    ->key(array(
    'lid' => $lid,
    'language' => $target_language,
  ))
    ->fields(array(
    'lid' => $lid,
    'translation' => $content,
    'language' => $target_language,
  ))
    ->execute();
}