voidlabs / htmml

A markup language extending HTML to enable templating specifically designed for email (supports conditional comments)
MIT License
5 stars 1 forks source link

Add template theming and localization #2

Closed francescbassas closed 2 years ago

francescbassas commented 5 years ago

Following the thread of https://github.com/voidlabs/mosaico/issues/399...

I've been playing with htmml version for versafix and I love it. When I used a template mosaico for the first time it was hard, with htmml it's less painful. However for template maintainability purposes I'm interested to have a localization and theming tool. For example, given one template and a set of theme and translation settings htmml could generate the corresponding version templates in the defined languages and themes.

At the time we developed a small PHP tool that works in this direction: Mosaico Templating Tool.

bago commented 2 years ago

Well, this is a very late answer, but maybe you are interested in our approach to the localization issue for the versafix template: https://github.com/voidlabs/versafix-template/blob/master/src/translator.js https://github.com/voidlabs/versafix-template/blob/master/template-def/template-versafix-1.it.json

This doesn't require changes to the main htmml template definition as it "automagically" tries to extract texts to be translated: it also automatically identifies new strings to be translated and log them on the translation task.

Using advanded replacements like the ones in the "customReplacements" maybe this solution will work for theming, too (but we don't do theming, so I didn't think about this application): https://github.com/voidlabs/versafix-template/blob/master/template-def/template-versafix-1.voxmail.json

The solution from versafix-template is very "mosaico" specific as it looks into -ko-support "css" style model definition, so I decided to leave it in the versafix-template and not to put it in HTMML. HTMML is not mosaico specific and very generic microtemplating. But maybe in future it will become generic enought to be ported to HTMML or to its own microproject so to be able to reuse it.

francescbassas commented 2 years ago

Thanks @bago. I'll check your tool for future iterations of our templates.

However the tool I developed allows me to not only maintain a different version in terms of language but also in terms of other settings such as colors, urls or default template options to manage for example multiple templates for different clients from the same template base.

I developed it in PHP because it was what I had on hand but I would like to be able to integrate it in the mosaico way at some point.