Forum
A simple addon to help with translations in templates
Hello,
I've created a simple add-on that aims to help with translations in templates, to prevent handling multiple if conditions. It's available here: https://github.com/ameego/rp_translationhelper. Open to contributions if you see any way to make it better!
Currently, it's only possible to pass either a string or a perch:content id.
<perch:translate id="myTranslation1" en="Static string" fr="Contenu statique" />
or <perch:translate id="myTranslation2" en="content_en" fr="content_fr" />
.
I will see what I can do to pass directly perch:content
so that one can do: <perch:translate id="myTranslation2" en="<perch:content id="content_en" type="text" />" fr="<perch:content id="content_fr" type="text" />" />
Hope it will be helpful to some people out here. Cheers!
Good stuff. Will add this to the next issue of Perchology newsletter.
Nice! Thanks for sharing.
I should say thanks to you for writing this nice article about building an add-on in Perch. That got me started :)
Good to hear! That's a good use of template handlers. I'm currently working on a multilingual project so I might use your addon for this.