Description
Since updating one of our stores to Magento 2.2 the translations for 'Item in Cart' are not compiled into the var/view_processed/pub/static/frontend/{Magento-Theme}/{language code}/js-translation.json files, though the translations for 'Items in Cart' are correctly loaded.
Preconditions
- Magento 2.2.0
- PHP 7.0 and 7.1 (different local setups and different testservers)
- MySQL 5.5.5-10.1.23-MariaDB
Steps to reproduce
- Have a store view in another language than en_US.
- Set a translation for 'Item in Cart' for that language.
- Open your store with the store view according to language, where you expect the translation to be done.
- Add exactly one item to your cart.
- Open the mini cart.
Expected result
- 'Item to Cart' translated to store view given language.
Actual result
- 'Item to Cart' is not translated.
Details
So the problem or at least a symptom of the problem seems to be in the 'vendor/magento/module-checkout/view/frontend/web/template/minicart/content.html' template. Strangely not all 'translate'-nodes are triggering the Magento 2 Content Compiler to actually set the requested translations into the theme and language given js-translations.json files.
Though the lines
33 - <translate args="'Item in Cart'" if="getCartLineItemsCount() === 1"/>
and
34 - <translate args="'Items in Cart'" if="getCartLineItemsCount() > 1"/>
are almost completely identical, the translations for 'Items in Cart' are loaded, but not for 'Item in Cart'.