With Email-Makr you design only one twig template and a csv with translated block. Then Email-Makr will generate all variants for your email.
Email-Makr takes as first argument a path to a twig template. It could be any valid twig template. For exemple:
<li>lang : {{ lang }}</li>
<li>var1 : {{ var1 }}</li>
<li>var1 : {{ var2 }}</li>
Email-Makr takes as second argument a path to a csv file. The csv file should contains a least :
- One header row, with variable name. Theses variable names will be uses in twig template
- Many row, with in the first column the target language. For exemple:
var1 | var2 | |
en | value en 1 | value en 2 |
fr | value fr 1 | value fr 2 |
See exemple
for more information.
emailmakr template.html.twig datas.csv
Options:
--output-directory
, default:./emailings/
--output-format
, default:"mail_LANG.html
.LANG
is a placeholder. It will be remplaced by the current language
Ouput looks for:
$ ./emailmakr.php generate-email index.html.twig datas.csv
Generated "/var/www/dev/sensio/emailings/exemple/emailings/mail_fr.html"
Generated "/var/www/dev/sensio/emailings/exemple/emailings/mail_en.html"
Generated "/var/www/dev/sensio/emailings/exemple/emailings/mail_es.html"
Generated "/var/www/dev/sensio/emailings/exemple/emailings/mail_it.html"
Finished
Downlaod email-makr
and run it: php email-makr
.
composer create-project lyrixx/email-makr email-makr