foreach ($kernel->
getBundles() as $bundle) { $bundleDir =
$bundle->
getPath();
$transPaths[] =
is_dir($bundleDir.'/Resources/translations'
) ?
$bundleDir.'/Resources/translations' :
$bundle->
getPath().'/translations';
$codePaths[] =
is_dir($bundleDir.'/Resources/views'
) ?
$bundleDir.'/Resources/views' :
$bundle->
getPath().'/templates';
} } // Extract used messages
$extractedCatalogue =
$this->
extractMessages($locale,
$codePaths);
// Load defined messages
$currentCatalogue =
$this->
loadCurrentMessages($locale,
$transPaths);
// Merge defined and extracted messages to get all message ids
$mergeOperation =
new MergeOperation($extractedCatalogue,
$currentCatalogue);
$allMessages =
$mergeOperation->
getResult()->
all($domain);
if (null !==
$domain) { $allMessages =
[$domain =>
$allMessages];
} // No defined or extracted messages
if (!
$allMessages || null !==
$domain &&
empty($allMessages[$domain])) { $outputMessage =
sprintf('No defined or extracted messages for locale "%s"',
$locale);