Closed mplodowski closed 2 years ago
This code seems to work, but I don't know if this will work for all cases.
Event::listen('rainlab.translate.themeScanner.afterScan', function (ThemeScanner $scanner) {
$messages = [];
$manager = ComponentManager::instance();
foreach ($manager->listComponents() as $componentClass) {
$componentObj = $manager->makeComponent($componentClass);
$partial = ComponentPartial::load($componentObj, 'default');
if ($partial) {
$messages = array_merge($messages, $scanner->parseContent($partial->content));
}
}
Message::importMessages($messages);
});
We can include this in addition to the other checks. However, it won't cover partials inside the components directory other than the default one. Most components should strive to be encapsulated in a single template, this makes them easy to override, so this proposal is helpful to include.
Added this in 8c66aeba6e50dab37ba88fa2c94f767c4810207c
It seems like plugin components views are not scanned for translated messages.