function LocaleTranslationSource::fromProject

Same name and namespace in other branches
  1. 11.x core/modules/locale/src/LocaleTranslationSource.php \Drupal\locale\LocaleTranslationSource::fromProject()

Create a LocaleTranslationSource object from a project.

Parameters

\Drupal\locale\LocaleTranslatableProject $project: The locale project.

string $langcode: The language code to create this source for.

Return value

static

1 call to LocaleTranslationSource::fromProject()
LocaleSource::sourceBuild in core/modules/locale/src/LocaleSource.php
Builds abstract translation source.

File

core/modules/locale/src/LocaleTranslationSource.php, line 85

Class

LocaleTranslationSource
Provides source and translation status information for a project/langcode.

Namespace

Drupal\locale

Code

public static function fromProject(LocaleTranslatableProject $project, string $langcode) : static {
  $source = new static($project->name, $langcode);
  $source->server_pattern = $project->server_pattern;
  $source->version = $project->version;
  return $source;
}

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