MBoori | 4 Sep 2012 13:02
Picon

how to convert message type into string

Hello


I'm new to the Yesod. I read few tutorials. Most tutorials used messages through hamlet code.For example, this code from Yesod book http://www.yesodweb.com/book/internationalization
getRootR :: Handler RepHtml getRootR = defaultLayout [whamlet| <h1>_{MsgHello} <form action= <at> {BuyR}> _{MsgEnterItemCount} <input type=text name=count> <input type=submit value=_{MsgPurchase}> <form action= <at> {LangR} method=post> _{MsgSwitchLanguage} <select name=lang> <option value=en>English <option value=he>Hebrew <input type=submit value=_{MsgSwitch}> |]

but I want to be able to use them without putting them in a hamlet code. is there a way to convert them into String or Text.

Felipe Almeida Lessa | 4 Sep 2012 14:00
Picon
Gravatar

Re: how to convert message type into string

Just use getMessageRender.

  do $
    mr <- getMessageRender
    let t :: Text
        t = mr $ MsgFooBar baz

Cheers!

On 9/4/12, MBoori <mujtaba.boori@...> wrote:
> Hello
>
> I'm new to the Yesod. I read few tutorials. Most tutorials used messages
> through hamlet code.For example, this code from Yesod book
> http://www.yesodweb.com/book/internationalization
> getRootR :: Handler RepHtml getRootR = defaultLayout [whamlet| <h1>_{
> MsgHello} <form action= <at> {BuyR}> _{MsgEnterItemCount} <input type=text
> name=count> <input type=submit value=_{MsgPurchase}> <form action= <at> {LangR}
> method=post> _{MsgSwitchLanguage} <select name=lang> <option value=en>
> English <option value=he>Hebrew <input type=submit value=_{MsgSwitch}> |]
>
> but I want to be able to use them without putting them in a hamlet code. is
>
> there a way to convert them into String or Text.
>
>

--

-- 
Felipe.


Gmane