Sometimes after creating a dictionary, I get this error:
Undefined offset: 1 in /vendor/magento/framework/App/Language/Dictionary.php
a:4:{i:0;s:104:"Notice: Undefined offset: 1 in /srv/www/vendor/magento/framework/App/Language/Dictionary.php on line 196";i:1;s:4066:"#0 /srv/www/vendor/magento/framework/App/Language/Dictionary.php(196): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined offse...', '/srv/www/vendor...', 196, Array) #1 /srv/www/vendor/magento/framework/App/Language/Dictionary.php(113): Magento\Framework\App\Language\Dictionary->readPackCsv('bleez', 'pt_br') #2 /srv/www/vendor/magento/framework/Translate.php(325): Magento\Framework\App\Language\Dictionary->getDictionary('pt_BR') #3 /srv/www/vendor/magento/framework/Translate.php(181):
The function which is in this path vendor\magento\framework\App\Language\Dictionary.php
:
private function readPackCsv($vendor, $package)
{
$path = $this->componentRegistrar->getPath(ComponentRegistrar::LANGUAGE, strtolower($vendor . '_' . $package));
$result = [];
if (isset($path)) {
$directoryRead = $this->directoryReadFactory->create($path);
$foundCsvFiles = $directoryRead->search("*.csv");
foreach ($foundCsvFiles as $foundCsvFile) {
$file = $directoryRead->openFile($foundCsvFile);
while (($row = $file->readCsv()) !== false) {
$result[$row[0]] = $row[1];
}
}
}
return $result;
}
The problem is that there is a line in the dictionary which is not written properly, meaning that the fields are not properly created ( missing coma, or more than a comma) so the function sends an error. But the error doesn't give you any information about the line you have the error and with 13000 lines, you can't check each one.
So, which is the way you can know which line of the dictionary you created is wrong?