Configurable

ReplaceLocaleBatchProceduralFunctionsRector

Replace deprecated locale batch procedural functions with LocaleFetch, LocaleImportBatch, LocaleConfigBatch, and LocaleProjectChecker service methods.

-locale_translate_batch_build($files, $options);
+\Drupal::service(\Drupal\locale\LocaleImportBatch::class)->buildBatch($files, $options);

Configure your rector.php:

<?php

use DrupalRector\Drupal11\Rector\Deprecation\ReplaceLocaleBatchProceduralFunctionsRector;
use DrupalRector\Rector\ValueObject\DrupalIntroducedVersionConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(ReplaceLocaleBatchProceduralFunctionsRector::class, [
        new DrupalIntroducedVersionConfiguration('11.4.0'),
    ]);

-locale_config_batch_update_components($options, $langcodes, $components, $update_default_config_langcodes);
+\Drupal::service(\Drupal\locale\LocaleConfigBatch::class)->buildBatch($options, $langcodes, $components, $update_default_config_langcodes);

Configure your rector.php:

<?php

use DrupalRector\Drupal11\Rector\Deprecation\ReplaceLocaleBatchProceduralFunctionsRector;
use DrupalRector\Rector\ValueObject\DrupalIntroducedVersionConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(ReplaceLocaleBatchProceduralFunctionsRector::class, [
        new DrupalIntroducedVersionConfiguration('11.4.0'),
    ]);

-locale_translation_check_projects_batch($projects, $langcodes);
+\Drupal::service(\Drupal\locale\LocaleProjectChecker::class)->triggerBatch($projects, $langcodes);

Configure your rector.php:

<?php

use DrupalRector\Drupal11\Rector\Deprecation\ReplaceLocaleBatchProceduralFunctionsRector;
use DrupalRector\Rector\ValueObject\DrupalIntroducedVersionConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(ReplaceLocaleBatchProceduralFunctionsRector::class, [
        new DrupalIntroducedVersionConfiguration('11.4.0'),
    ]);