[erlang-questions] Best Practices: Localization of Erlang Applications. Also, Error Messages!

Alex Arnon alex.arnon@REDACTED
Thu Jul 14 13:31:57 CEST 2011


On Thu, Jul 14, 2011 at 1:56 PM, Loïc Hoguin <essen@REDACTED> wrote:

> On 07/13/2011 09:19 PM, Alex Arnon wrote:
> > Hi All,
> >
> > We're building a nontrivial Erlang application, which will provide a
> > potentially high-volume, public RESTful Web Service. As part of the API,
> > we will be providing both informative text (status, labels, layout
> > templates) and error messages. A twofold question, then, to the
> > experienced Grandmasters in the audience:
> > 1. How have you implemented localization of text? This includes
> > parameterized format strings.
>
> I don't know how well it works but there's always:
>  http://www.trapexit.org/Gettext_-_An_internationalization_package.
>
> I'll be interested hearing what you find works best.
>

Thank you, I shall look into it.
And report :)


>
> > 2. Has anyone used composite error values? For example, instead of
> > {error, badarg}, use {error, {badarg, [{arg, ArgumentName}, {message,
> > LocalizedMessageId}, {message_args, [...]}... Should we steer clear of
> > these, and if so, what alternative would you suggest?
>
> OTP uses format_error functions to format the errors. You could use the
> same pattern in your case but internationalized. For example passing
> {error, badarg, What} to the function would give the formatted version
> in the currently selected language.
>
> --
> Loďc Hoguin
> Dev:Extend
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110714/fc380e8f/attachment.htm>


More information about the erlang-questions mailing list