I installed this language pack https://github.com/splendidinternet/Magento2_German_LocalePack_de_DE. Everything worked fine.
Then I edited the following line in the magento-path\app\i18n\splendid\de_DE\de_DE.csv
file:
"Add to Cart,Zum Warenkorb hinzufügen -> Add to Cart,In den Warenkorb"
When I go to category page, at first everything looks fine:
but when I click on the 'add to cart'(In den Warenkorb) button , the button text changes back to the translation "Zum Warenkorb hinzufügen", which was there before I edited the de_DE.csv
file:
When I reload the site everything looks good again:
I think it has something to do with JS. Any hints on solving this issue ?
UPDATE: Changed Code in pub\static\frontend\<vendor>\<theme>\de_DE\Magento_Catalog\js\catalog-add-to-cart.js
:
setTimeout(function() {
var addToCartButtonTextDefault = 'In den Warenkorb'; //changed
console.log("test1"); addToCartButton.removeClass(self.options.addToCartButtonDisabledClass);
addToCartButton.find('span').text(addToCartButtonTextDefault);
console.log("test2");
addToCartButton.attr('title', addToCartButtonTextDefault);
}, 1000);
Now it works
pub/static
, the code will lose.