3

I've been using Yesod's messages system to help keep my language consistent. For example, I have a message named MsgBrand, which gets interpolated into Hamlet files with no problem. However, I am now using a JavaScript library which needs this kind of information.

var tour = Tour.new();

tour.addSteps([
  { element: "#some-id",
    title:   "Some Title",
    content: "_{MsgTourStepFoo}"
  }
]);

However, _{MsgTourStepFoo} is appearing in the rendered JavaScript code verbatim. In other words, there is no interpolation. Is this normal or am I missing something?

Ry-
  • 218,210
  • 55
  • 464
  • 476
nomen
  • 3,626
  • 2
  • 23
  • 40

1 Answers1

2

This is normal. We could have a i18n-variant of Julius, but have avoided it so far simply because it seems like it would be more confusion than it's worth. Instead, you can use getMessageRender to get the message rendering function and then call it from Julius, something like:

Haskell:
messageRender <- getMessageRender

Julius:
content: "#{messageRender MsgTourStepFoo}"
Michael Snoyman
  • 31,100
  • 3
  • 48
  • 77
  • Okay, I understand. I find it kind of surprising though. Thanks Michael, for Yesod and your help. :) – nomen Oct 15 '13 at 15:43
  • It's good, but I got this error: Foundation.hs:85:26: No instance for (RenderMessage App message0) arising from a use of ‘getMessageRender’ The type variable ‘message0’ is ambiguous – Denis Shevchenko Nov 24 '14 at 18:38