Magento 2 bug: «bin/magento setup:static-content:deploy -f <multiple locales>» does not generate a correct «js-translation.json» for the second and next locales (and my fix)

How to reprodice

The following command will wrongly generate an empty js-translation.json file for the ru_RU locale:

rm -rf pub/static/* && bin/magento setup:static-content:deploy -f en_US ru_RU --area frontend --theme Magento/luma

How to fix

Locate the method Magento\Deploy\Service\DeployTranslationsDictionary::deploy():

Add the following code at the beginning for the method:

/** @var \Magento\Framework\TranslateInterface $t */
$t = \Magento\Framework\App\ObjectManager::getInstance()->get(
	\Magento\Framework\TranslateInterface::class
);
$t->setLocale($locale)->loadData($area, true);

https://github.com/magento/magento2/issues/10673