function LocaleSource::buildSources
Build translation sources.
Parameters
array $projects: Array of project names. Defaults to all translatable projects.
array $langcodes: Array of language codes. Defaults to all translatable languages.
Return value
array Array of source objects. Keyed by project name and language code.
See also
sourceBuild()
File
-
core/
modules/ locale/ src/ LocaleSource.php, line 63
Class
- LocaleSource
- Provides the locale source services.
Namespace
Drupal\localeCode
public function buildSources(array $projects = [], array $langcodes = []) : array {
$sources = [];
$projects = $this->projectStorage
->getProjects($projects);
$langcodes = $langcodes ?: array_keys(locale_translatable_language_list());
foreach ($projects as $project) {
foreach ($langcodes as $langcode) {
$source = $this->sourceBuild($project, $langcode);
$sources[$source->name][$source->langcode] = $source;
}
}
return $sources;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.