--- On Mon, 6/28/10, MightyByte <[email protected]> wrote:

> 
> My current recommendation would be to use a different
> approach.  A
> post-run hook seems like the simplest way to do this. 
> You might do
> something like the following:
> 
> postRun :: Monad m => Map String String -> Template
> -> m Template
> postRun stringLangs t = return $ map (mapAllTags translate)
> t
>   where
>     translate str = fromMaybe str $ Map.lookup
> str stringLangs
> 
> ...and then use (addPostRunHook postRun) when you
> initialize your TemplateState.
> 
> If you don't want to incur the (small?) performance penalty
> of the
> post-run hook, you could use an on-load hook and then make
> sure all
> your dynamic splices generate strings that are translated
> correctly.
> 
> Does this make sense?
> 

Yes, I think so if this approach allows localised strings to have embedded 
tags. The web app I am currently using just uses %s and sprintf when inserting 
parameters into localised strings. But this approach seems primitive given the 
XML power of Heist. So I want to include tags (which always rennder to 
bytestrings) instead.

Kevin


      
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to