You are here

function lingotek_get_upload_string in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.bulk_grid.inc \lingotek_get_upload_string()

Display the language string (including overridden language, if any)

1 call to lingotek_get_upload_string()
lingotek_render_source in ./lingotek.bulk_grid.inc

File

./lingotek.bulk_grid.inc, line 2209

Code

function lingotek_get_upload_string($row, $languages) {
  $actual_source_lang = lingotek_row_source_language($row);
  $lang_overridden = !empty($row->lang_override) ? TRUE : FALSE;
  $marked_language = !empty($languages[$row->language]->name) ? t($languages[$row->language]->name) : t('Unnamed (@language_code)', array(
    '@language_code' => $row->language,
  ));
  $actual_language = !empty($languages[$actual_source_lang]->name) ? t($languages[$actual_source_lang]->name) : t('Unnamed (@language_code)', array(
    '@language_code' => $actual_source_lang,
  ));
  $original_language = !empty($row->original_lang) && !empty($languages[$row->original_lang]->name) ? t($languages[$row->original_lang]->name) : $actual_language;
  if ($lang_overridden) {
    if ($actual_source_lang != $row->language) {
      $span_title = t('Language Override: This source content is marked as @marked_language in Drupal but is written in @actual_language.', array(
        '@marked_language' => $marked_language,
        '@actual_language' => $actual_language,
      ));
    }
    else {
      $span_title = t('Language Override: This source content was uploaded as @original_language to Lingotek but is now @marked_language. Re-uploading this in its current state may corrupt the translation for this document.', array(
        '@marked_language' => $marked_language,
        '@original_language' => $original_language,
      ));
    }
    $response = '<span title="' . $span_title . '">' . t($original_language) . (!empty($row->overridden_source_target_icon) ? '&nbsp;&nbsp;&nbsp;' . $row->overridden_source_target_icon : '') . '</span>';
  }
  else {
    $response = empty($row->language) || $row->language == LANGUAGE_NONE ? t('Language Neutral') : t($languages[$row->language]->name);
  }
  return $response;
}