You are here

function locale_translation_project_list in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/locale/locale.compare.inc \locale_translation_project_list()
  2. 9 core/modules/locale/locale.compare.inc \locale_translation_project_list()

Fetch an array of projects for translation update.

Return value

array Array of project data including .info.yml file data.

2 calls to locale_translation_project_list()
LocaleUpdateTest::testUpdateProjects in core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php
Checks if a list of translatable projects gets build.
locale_translation_build_projects in core/modules/locale/locale.compare.inc
Builds list of projects and stores the result in the database.
1 string reference to 'locale_translation_project_list'
LocaleBuildTest::testBuildProjects in core/modules/locale/tests/src/Kernel/LocaleBuildTest.php
Checks if a list of translatable projects gets built.

File

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

Code

function locale_translation_project_list() {
  $projects =& drupal_static(__FUNCTION__, []);
  if (empty($projects)) {
    $projects = [];
    $additional_whitelist = [
      'interface translation project',
      'interface translation server pattern',
    ];
    $module_data = _locale_translation_prepare_project_list(\Drupal::service('extension.list.module')
      ->getList(), 'module');
    $theme_data = _locale_translation_prepare_project_list(\Drupal::service('theme_handler')
      ->rebuildThemeData(), 'theme');
    $project_info = new ProjectInfo();
    $project_info
      ->processInfoList($projects, $module_data, 'module', TRUE, $additional_whitelist);
    $project_info
      ->processInfoList($projects, $theme_data, 'theme', TRUE, $additional_whitelist);

    // Allow other modules to alter projects before fetching and comparing.
    \Drupal::moduleHandler()
      ->alter('locale_translation_projects', $projects);
  }
  return $projects;
}