function locale_translation_get_status
Same name and namespace in other branches
- 10 core/modules/locale/locale.module \locale_translation_get_status()
- 11.x core/modules/locale/locale.module \locale_translation_get_status()
- 9 core/modules/locale/locale.module \locale_translation_get_status()
- 8.9.x core/modules/locale/locale.module \locale_translation_get_status()
Gets the current translation status.
@todo What is 'translation status'?
16 calls to locale_translation_get_status()
- InstallerExistingConfigSyncDirectoryMultilingualTest::testConfigSync in core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerExistingConfigSyncDirectoryMultilingualTest.php - Confirms that the installation installed the configuration correctly.
- LocaleConfigTranslationImportTest::testConfigTranslationImport in core/
modules/ locale/ tests/ src/ Functional/ LocaleConfigTranslationImportTest.php - Tests update changes configuration translations if enabled after language.
- LocaleRequirements::runtime in core/
modules/ locale/ src/ Hook/ LocaleRequirements.php - Implements hook_runtime_requirements().
- LocaleSource::loadSources in core/
modules/ locale/ src/ LocaleSource.php - Loads cached translation sources containing current translation status.
- LocaleTranslationChangeProjectVersionTest::setUp in core/
modules/ locale/ tests/ src/ Functional/ LocaleTranslationChangeProjectVersionTest.php
File
-
core/
modules/ locale/ locale.module, line 520
Code
function locale_translation_get_status($projects = NULL, $langcodes = NULL) : array {
$result = [];
$status = \Drupal::keyValue('locale.translation_status')->getAll();
$projects = $projects ?: array_keys(\Drupal::service('locale.project')->getProjects());
$langcodes = $langcodes ?: array_keys(locale_translatable_language_list());
// Get the translation status of each project-language combination. If no
// status was stored, a new translation source is created.
foreach ($projects as $project) {
foreach ($langcodes as $langcode) {
if (isset($status[$project][$langcode])) {
$result[$project][$langcode] = $status[$project][$langcode];
}
else {
$sources = \Drupal::service(LocaleSource::class)->buildSources([
$project,
], [
$langcode,
]);
if (isset($sources[$project][$langcode])) {
$result[$project][$langcode] = $sources[$project][$langcode];
}
}
}
}
return $result;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.