Unfortunately is really hard from the output to understand what file is blocking the export, I have also checked the log folder (var/log) but there is no trace of this error.
I'm getting 'Dictionary successfully processed.' on clean magento. Problem must be in your language pack. Try add '-vvv' option to see broken file.
@sevos1984 thanks for the suggestion, I tried adding -vvv and this is the result
[DomainException]
Missed phraseException trace:
() at /var/html/magento/setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php:90
MagentoSetupModuleI18nDictionaryPhrase->setPhrase() at /var/html/magento/setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php:73
MagentoSetupModuleI18nDictionaryPhrase->__construct() at /var/html/magento/setup/src/Magento/Setup/Module/I18n/Factory.php:69
MagentoSetupModuleI18nFactory->createPhrase() at /var/html/magento/setup/src/Magento/Setup/Module/I18n/Parser/Contextual.php:79
MagentoSetupModuleI18nParserContextual->_addPhrase() at /var/html/magento/setup/src/Magento/Setup/Module/I18n/Parser/Contextual.php:51
MagentoSetupModuleI18nParserContextual->_parseByTypeOptions() at /var/html/magento/setup/src/Magento/Setup/Module/I18n/Parser/AbstractParser.php:75
MagentoSetupModuleI18nParserAbstractParser->parse() at /var/html/magento/setup/src/Magento/Setup/Module/I18n/Dictionary/Generator.php:83
MagentoSetupModuleI18nDictionaryGenerator->generate() at /var/html/magento/setup/src/Magento/Setup/Console/Command/I18nCollectPhrasesCommand.php:77
MagentoSetupConsoleCommandI18nCollectPhrasesCommand->execute() at /var/html/magento/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
SymfonyComponentConsoleCommandCommand->run() at /var/html/magento/vendor/symfony/console/Symfony/Component/Console/Application.php:874
SymfonyComponentConsoleApplication->doRunCommand() at /var/html/magento/vendor/symfony/console/Symfony/Component/Console/Application.php:195
SymfonyComponentConsoleApplication->doRun() at /var/html/magento/vendor/magento/framework/Console/Cli.php:96
MagentoFrameworkConsoleCli->doRun() at /var/html/magento/vendor/symfony/console/Symfony/Component/Console/Application.php:126
SymfonyComponentConsoleApplication->run() at /var/html/magento/bin/magento:23i18n:collect-phrases [-o|--output="..."] [-m|--magento] [directory]
I've recreated your issue, it occurs when you have empty strings for translation (e.g 'note' => __('')).
Ah, so perhaps somewhere in the template I have empty translation strings? There is a command to output the file containing empty strings? Thanks
Yes, check your templates. No there is no such command.
@sevos1984 thank you very much for the suggestion infact there was a missing translation that I found, now the export works correctly, I close this post as solved.
Hello, I have the same issue. Where I can find "empty strings" ? No translations where done, so, from where those empty strings come?
Anyway, it's quite a strange thing because very first time when I ran collect-phrases everything was fine, but now it shows "missed phrase"...
@gediminaskv Maybe you can modify setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php file, and comment the DomainException in setPhrase() and setTranslation() methods like this:
public function setPhrase($phrase)
{
if (!$phrase) {
// throw new \DomainException('Missed phrase');
$this->_phrase = 'Missed phrase';
} else {
$this->_phrase = $phrase;
}
}
public function setTranslation($translation)
{
if (!$translation) {
// throw new \DomainException('Missed translation');
$this->_translation = 'Missed translation';
} else {
$this->_translation = $translation;
}
}
And this will create .csv successfully, what's more, you can find the module of the "empty strings".
__('0'); also fails.
Magento should be able to handle empty phrases. I dont understand why do they not handle such small things.
Such issues cause developers to loose many hours.
Agreed with @webspeaks tranlating is already a pain in M2, this makes it even worse.
Err I did not unassign @sevos1984 ?
Yes, check your templates. No there is no such command.
There is no such command but there is a search that works
Run this in your root folder to find all of the missing / empty strings
grep -rnw . -e "__('')" -e '__("")'
I have used this successfully several times.
I also like to email the plugin providers to let them know when they have missed a couple.
Most helpful comment
@gediminaskv Maybe you can modify setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php file, and comment the DomainException in setPhrase() and setTranslation() methods like this:
And this will create .csv successfully, what's more, you can find the module of the "empty strings".