You are here

function lingotek_row_source_language in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.6 lingotek.bulk_grid.inc \lingotek_row_source_language()

Return source language code to be used by Lingotek

1 call to lingotek_row_source_language()
lingotek_get_upload_string in ./lingotek.bulk_grid.inc
Display the language string (including overridden language, if any)

File

./lingotek.bulk_grid.inc, line 3311

Code

function lingotek_row_source_language($row) {
  if (!empty($row->lang_override)) {
    $overrides = explode(',', $row->lang_override);
    $override_map = array();
    foreach ($overrides as $o) {
      list($k, $v) = explode(':', $o);
      $override_map[$k] = $v;
    }
    $drupal_source_locale = Lingotek::convertDrupal2Lingotek($row->language);
    $overridden_source_lang = !empty($override_map[$drupal_source_locale]) ? $override_map[$drupal_source_locale] : NULL;
    if (!empty($overridden_source_lang)) {
      return $overridden_source_lang;
    }
  }
  return $row->language;
}