function locale_translation_check_projects_local

Check and store the status and timestamp of local po files.

Only po files in the local file system are checked. Any remote translation sources will be ignored. Results are stored in the state variable 'locale_translation_status'.

Projects may contain a server_pattern option containing a pattern of the path to the po source files. If no server_pattern is defined the default translation directory is checked for the po file. When a server_pattern is defined the specified location is checked. The server_pattern can be set in the module's .info file or by using hook_locale_translation_projects_alter().

@params array $projects Array of translatable projects. @params array $langcodes Array of language codes to check for. Leave empty to check all languages.

1 call to locale_translation_check_projects_local()
locale_translation_check_projects in drupal/core/modules/locale/locale.compare.inc
Check for the latest release of project translations.

File

drupal/core/modules/locale/locale.compare.inc, line 369
The API for comparing project translation status with available translation.

Code

function locale_translation_check_projects_local($projects, $langcodes = NULL) {
  $langcodes = $langcodes ? $langcodes : array_keys(locale_translatable_language_list());
  $results = array();

  // For each project and each language we check if a local po file is
  // available. When found the source object is updated with the appropriate
  // type and timestamp of the po file.
  foreach ($projects as $name => $project) {
    foreach ($langcodes as $langcode) {
      $source = locale_translation_source_build($project, $langcode);
      if (locale_translation_source_check_file($source)) {
        $source->type = 'local';
        $source->timestamp = $source->files['local']->timestamp;
        $results[$name][$langcode] = $source;
      }
    }
  }
  state()
    ->set('locale_translation_status', $results);
  state()
    ->set('locale_translation_status_last_update', REQUEST_TIME);
}