Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix : translate message sent in log file #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

class Import implements ImportInterface
{
protected ConfigurationInterface $configuration;
protected Connection $connection;
protected EventDispatcherInterface $dispatcher;
protected TranslatorInterface $translator;
protected LoggerInterface $logger;
protected Collection $config;
protected StrategyRepositoryInterface $strategyRepository;
Expand All @@ -41,13 +43,15 @@ public function __construct(
StrategyRepositoryInterface $strategyRepository,
LoadStrategyRepositoryInterface $loadStrategyRepository,
ConfigurationInterface $configuration,
TranslatorInterface $translator,
?LoggerInterface $logger = null
) {
$this->configuration = $configuration;
$this->connection = $connection;
$this->dispatcher = $dispatcher;
$this->strategyRepository = $strategyRepository;
$this->loadStrategyRepository = $loadStrategyRepository;
$this->translator = $translator;
$this->logger = $logger ?? new NullLogger();
$this->loaders = new ArrayCollection();
}
Expand Down Expand Up @@ -199,10 +203,10 @@ private function loadResource(ImportResource $resource): bool
}

if (($count = $this->loadData($resource, $file)) !== 0) {
$this->logger->notice('{file}: {count} lines loaded', [
'file' => $file->getBasename(),
'count' => $count, ]
);
$this->logger->notice($this->translator->trans('{file}: {count} lines loaded', [
'{file}' => $file->getBasename(),
'{count}' => $count,
]));
$loaded = true;
}
}
Expand Down
Loading