function _locale_translation_fetch_operations

Same name in other branches
  1. 8.9.x core/modules/locale/locale.fetch.inc \_locale_translation_fetch_operations()
  2. 10 core/modules/locale/locale.fetch.inc \_locale_translation_fetch_operations()
  3. 11.x core/modules/locale/locale.fetch.inc \_locale_translation_fetch_operations()

Helper function to construct the batch operations to fetch translations.

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.

array $options: Array of import options.

Return value

array Array of batch operations.

2 calls to _locale_translation_fetch_operations()
locale_translation_batch_fetch_build in core/modules/locale/locale.fetch.inc
Builds a batch to download and import project translations.
locale_translation_batch_update_build in core/modules/locale/locale.fetch.inc
Builds a batch to check, download and import project translations.

File

core/modules/locale/locale.fetch.inc, line 98

Code

function _locale_translation_fetch_operations($projects, $langcodes, $options) {
    $operations = [];
    foreach ($projects as $project) {
        foreach ($langcodes as $langcode) {
            if (locale_translation_use_remote_source()) {
                $operations[] = [
                    'locale_translation_batch_fetch_download',
                    [
                        $project,
                        $langcode,
                    ],
                ];
            }
            $operations[] = [
                'locale_translation_batch_fetch_import',
                [
                    $project,
                    $langcode,
                    $options,
                ],
            ];
        }
    }
    return $operations;
}

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