<div dir="ltr"><br><br><div class="gmail_quote">On Thu, Jul 14, 2011 at 1:56 PM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@dev-extend.eu">essen@dev-extend.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 07/13/2011 09:19 PM, Alex Arnon wrote:<br>
> Hi All,<br>
><br>
> We're building a nontrivial Erlang application, which will provide a<br>
> potentially high-volume, public RESTful Web Service. As part of the API,<br>
> we will be providing both informative text (status, labels, layout<br>
> templates) and error messages. A twofold question, then, to the<br>
> experienced Grandmasters in the audience:<br>
> 1. How have you implemented localization of text? This includes<br>
> parameterized format strings.<br>
<br>
</div>I don't know how well it works but there's always:<br>
  <a href="http://www.trapexit.org/Gettext_-_An_internationalization_package" target="_blank">http://www.trapexit.org/Gettext_-_An_internationalization_package</a>.<br>
<br>
I'll be interested hearing what you find works best.<br></blockquote><div><br>Thank you, I shall look into it.<br>And report :)<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im"><br>
> 2. Has anyone used composite error values? For example, instead of<br>
> {error, badarg}, use {error, {badarg, [{arg, ArgumentName}, {message,<br>
> LocalizedMessageId}, {message_args, [...]}... Should we steer clear of<br>
> these, and if so, what alternative would you suggest?<br>
<br>
</div>OTP uses format_error functions to format the errors. You could use the<br>
same pattern in your case but internationalized. For example passing<br>
{error, badarg, What} to the function would give the formatted version<br>
in the currently selected language.<br>
<font color="#888888"><br>
--<br>
Loďc Hoguin<br>
Dev:Extend<br>
</font></blockquote></div><br></div>