Change record status: 
Project: 
Introduced in branch: 
11.4.x
Introduced in version: 
11.4.0
Description: 

Several functions related to locale file management have been deprecated and replaced with the LocaleFile value object and LocaleFileManager service.

Before
locale_translation_download_source($source_file, $directory)
After
\Drupal::service(LocaleFileManager::class)->downloadTranslationSource($source_file, $directory)'temporary://')

Before
locale_translate_get_interface_translation_files($projects, $langcodes)
After

\Drupal::service(LocaleFileManager::class)
->getInterfaceTranslationFiles($projects, $langcodes)

Before
locale_translate_file_attach_properties($file, $options)
After
LocaleFile::createFromPath($filename, $filepath, $options['langcode'])

Before
locale_translate_delete_translation_files($projects, $langcodes)
After
\Drupal::service(LocaleFileManager::class)->deleteTranslationFiles($projects, $langcodes)

Before
locale_translation_http_check($uri)
After
\Drupal::service(LocaleFileManager::class)checkRemoteFileStatus($uri)

Before
locale_translate_file_create($filename, $filepath)
After
new LocaleFile($filepath, basename($filepath), $hash, filemtime($filepath))

There is a new RemoteFileInfo value object to track location, lastModified and status.

There is a new RemoteFileStatus enum to track the statuses of remote files with the following options.

  • Success
  • Error
  • Missing
Impacts: 
Module developers