function locale_translation_check_projects_local

Same name and namespace in other branches
  1. 10 core/modules/locale/locale.compare.inc \locale_translation_check_projects_local()
  2. 11.x core/modules/locale/locale.compare.inc \locale_translation_check_projects_local()
  3. 9 core/modules/locale/locale.compare.inc \locale_translation_check_projects_local()
  4. 8.9.x core/modules/locale/locale.compare.inc \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 files will be ignored.

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.yml file or by using hook_locale_translation_projects_alter().

Parameters

array $projects: Array of project names for which to check the state of translation files. Defaults to all translatable projects.

array $langcodes: Array of language codes. Defaults to all translatable languages.

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. Use \Drupal::service(LocaleProjectChecker::class)->checkLocalProjects() instead.

See also

https://www.drupal.org/node/3037033

File

core/modules/locale/locale.compare.inc, line 298

Code

function locale_translation_check_projects_local($projects = [], $langcodes = []) : void {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal::service(LocaleProjectChecker::class)->checkLocalProjects() instead. See https://www.drupal.org/node/3037033', E_USER_DEPRECATED);
  if (empty($projects)) {
    $projects = array_keys(\Drupal::service(LocaleProjectRepository::class)->getAll());
  }
  \Drupal::service(LocaleProjectChecker::class)->checkLocalProjects($projects, $langcodes);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.