function locale_translation_source_check_file

Same name and namespace in other branches
  1. 10 core/modules/locale/locale.translation.inc \locale_translation_source_check_file()
  2. 11.x core/modules/locale/locale.translation.inc \locale_translation_source_check_file()
  3. 9 core/modules/locale/locale.translation.inc \locale_translation_source_check_file()
  4. 8.9.x core/modules/locale/locale.translation.inc \locale_translation_source_check_file()

Checks whether a po file exists in the local filesystem.

It will search in the directory set in the translation source. Which defaults to the "translations://" stream wrapper path. The directory may contain any valid stream wrapper.

The "local" files property of the source object contains the definition of a po file we are looking for. The file name defaults to %project-%version.%language.po. Per project this value can be overridden using the server_pattern directive in the module's .info.yml file or by using hook_locale_translation_projects_alter().

Parameters

object $source: Translation source object.

Return value

object Source file object of the po file, updated with:

  • "uri": File name and path.
  • "timestamp": Last updated time of the po file.

FALSE if the file is not found.

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. Use \Drupal::service(LocaleSource::class)->sourceCheckFile($source) instead.

See also

locale_translation_source_build()

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

File

core/modules/locale/locale.translation.inc, line 173

Code

function locale_translation_source_check_file($source) {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal::service(LocaleSource::class)->sourceCheckFile($source) instead. See https://www.drupal.org/node/3569330', E_USER_DEPRECATED);
  return \Drupal::service(LocaleSource::class)->sourceCheckFile($source);
}

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