Multi-language heist templates?

31 views
Skip to first unread message

Pedro Vasconcelos

unread,
Jul 15, 2014, 6:57:24 AM7/15/14
to snap_fr...@googlegroups.com
Hello all,

I've used Snap to built a simple web app for student's programming assignments; right now it's Portuguese-only but I'm thinking of how best to support multi-languages. It should be fairly straightforward because all language-specific stuff is in templates rather than in splices. So I'm think of spliting the templates directory into sub-directories pt/en/fr/.. whatever and putting language-specific versions of the required templates. 

Is this a reasonable way to go about doing this? Any suggestions are welcome!

Pedro

Christopher Biscardi

unread,
Jul 15, 2014, 11:57:56 AM7/15/14
to snap_fr...@googlegroups.com
I've seen this snaplet in my research: http://hackage.haskell.org/package/snaplet-i18n but I haven't had occasion to use it myself.

Basically the approach there is to put the different values in i18n named files in the Snaplet's config dir. A splice could then be written to look up values for specific locales.

Personally I'd try to steer away from having duplicated templates as much as possible because in that scenario whenever you make a change to a template, you then have to remember to make and test n changes.

-Chris

MightyByte

unread,
Jul 15, 2014, 12:03:22 PM7/15/14
to snap_fr...@googlegroups.com
I was going to mention that snaplet, but Christopher beat me to it
(although I haven't used it either). The only thing I would add here
is that instead of thinking of it as a splice that looks up values for
locales, I would think of it as a preprocessing phase. You don't want
to have to have splices everywhere to ensure your site gets
translated. If it must be done as a splice, I'd make it a top-level
splice that you can wrap around everything that translates all the
text everywhere inside of it.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Snap Framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to snap_framewor...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages