You are here

public static function LingotekConfigChunk::saveSegmentTranslation in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.4 lib/Drupal/lingotek/LingotekConfigChunk.php \LingotekConfigChunk::saveSegmentTranslation()
  2. 7.5 lib/Drupal/lingotek/LingotekConfigChunk.php \LingotekConfigChunk::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/LingotekConfigChunk.php, line 192
Defines LingotekConfigChunk.

Class

LingotekConfigChunk
A class wrapper for Lingotek-specific behavior on ConfigChunks.

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();
}