You are here

function lingotek_admin_save_queued_strings in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.4 lingotek.admin.inc \lingotek_admin_save_queued_strings()
  2. 7.5 lingotek.admin.inc \lingotek_admin_save_queued_strings()
  3. 7.6 lingotek.admin.inc \lingotek_admin_save_queued_strings()
1 call to lingotek_admin_save_queued_strings()
lingotek_admin_add_module_index_job in ./lingotek.admin.inc

File

./lingotek.admin.inc, line 1155

Code

function lingotek_admin_save_queued_strings() {
  $plural_map = variable_get('lingotek_config_plural_mapping', array());
  global $_potx_strings, $_potx_install;
  foreach ($_potx_strings as $k => $v) {

    // get the context, if any
    reset($v);
    $context_location = key($v);
    $context = !empty($context_location) ? $context_location : NULL;

    // handle format_plural
    if (strpos($k, "\0")) {
      list($singular, $plural) = explode("\0", $k);
      locale($singular, $context, LANGUAGE_NONE);
      $single_lid = LingotekConfigSet::getLidBySource($singular);
      locale($plural, $context, LANGUAGE_NONE);
      $plural_lid = LingotekConfigSet::getLidBySource($plural);
      $plural_map[$plural_lid] = array(
        'plid' => $single_lid,
        'plural' => 1,
      );
    }
    else {

      // handle regular t-function content
      locale($k, $context, LANGUAGE_NONE);
    }
  }

  // TODO: do something with the _potx_install strings
  variable_set('lingotek_config_plural_mapping', $plural_map);
  $_potx_strings = array();
  $_potx_install = array();
}