function locale_translation_load_sources in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/locale/locale.translation.inc \locale_translation_load_sources()
Loads cached translation sources containing current translation status.
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 with <project name>:<language code>.
See also
locale_translation_source_build()
File
- core/
modules/ locale/ locale.translation.inc, line 102 - Common API for interface translation.
Code
function locale_translation_load_sources(array $projects = NULL, array $langcodes = NULL) {
$sources = array();
$projects = $projects ? $projects : array_keys(locale_translation_get_projects());
$langcodes = $langcodes ? $langcodes : array_keys(locale_translatable_language_list());
// Load source data from locale_translation_status cache.
$status = locale_translation_get_status();
// Use only the selected projects and languages for update.
foreach ($projects as $project) {
foreach ($langcodes as $langcode) {
$sources[$project][$langcode] = isset($status[$project][$langcode]) ? $status[$project][$langcode] : NULL;
}
}
return $sources;
}