This seems to be a Magento 2 bug, we have experienced a lot of localization issue in Magento 2. Especially for translating inside Javascript components and inside e-mails. Even if you do the correct thing according to documentation it often doesn't work. Please say if {{ trans }}
worked for you.
Other options are:
- Translating strings in theme and in language packages
- Make sure you clean all caches and rebuild everything
- Creating email templates that doesn't use localization features
To install language-pack do this:
curl -o source_de_DE.csv http://107.170.242.99/var/Head/source_de_DE.csv
bin/magento i18n:pack -m replace -d source_de_DE.csv de_DE
(I need to run this as root and then run permissions scripts to fix permissions again)
This is my permissions script that I run as root inside magento 2 root folder: (replace MY_WEB_SERVER_USER with your value)
#!/usr/bin/env bash
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find ./var -type d -exec chmod 777 {} \;
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
chown -R :MY_WEB_SERVER_USER .
chmod u+x bin/magento
Make sure you have executed this before testing:
bin/magento setup:static-content:deploy -l de_DE
(or your language)
bin/magento indexer:reindex
bin/magento cache:clean
bin/magento cache:flush
- Restart cache systems like
Varnish
and Redis