function locale_translation_source_build

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

Builds abstract translation source.

Parameters

object $project: Project object.

string $langcode: Language code.

string $filename: (optional) File name of translation file. May contain placeholders. Defaults to the default translation filename from the settings.

Return value

object Source object:

  • "project": Project name.
  • "name": Project name (inherited from project).
  • "language": Language code.
  • "core": Core version (inherited from project).
  • "version": Project version (inherited from project).
  • "project_type": Project type (inherited from project).
  • "files": Array of file objects containing properties of local and remote translation files.

Other processes can add the following properties:

  • "type": Most recent translation source found. LOCALE_TRANSLATION_REMOTE and LOCALE_TRANSLATION_LOCAL indicate available new translations, LOCALE_TRANSLATION_CURRENT indicate that the current translation is them most recent. "type" corresponds with a key of the "files" array.
  • "timestamp": The creation time of the "type" translation (file).
  • "last_checked": The time when the "type" translation was last checked.

The "files" array can hold file objects of type: LOCALE_TRANSLATION_LOCAL, LOCALE_TRANSLATION_REMOTE and LOCALE_TRANSLATION_CURRENT. Each contains following properties:

  • "type": The object type (LOCALE_TRANSLATION_LOCAL, LOCALE_TRANSLATION_REMOTE, etc. see above).
  • "project": Project name.
  • "langcode": Language code.
  • "version": Project version.
  • "uri": Local or remote file path.
  • "directory": Directory of the local po file.
  • "filename": File name.
  • "timestamp": Timestamp of the file.
  • "keep": TRUE to keep the downloaded file.

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. Use \Drupal::service(LocaleSource::class) ->sourceBuild($project, $langcode, $filename) instead.

See also

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

File

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

Code

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

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