node-http-status icon indicating copy to clipboard operation
node-http-status copied to clipboard

intl

Open shunkongcheung opened this issue 6 years ago • 1 comments

Any plan on supporting multi-language? Thanks

shunkongcheung avatar May 01 '19 08:05 shunkongcheung

The idea was never brought up but I am not against it. We've got english, I could handle the French and if you provide a 3rd language, that could be a good start.

Have you thought about the API. Currently, it is one large object literal with the "{code}_NAME" and "{code}_MESSAGE" properties. I am not sure "{code}_NAME" should and would be easy to translate, I consider them more as code than name. An easy way to handle this issue is to create an alternative "{code}_MESSAGE" property in the form of "{code}MESSAGE{lang}". An other way would be to expose a function which take the lang as argument and which contextualize the return object. The latter approach is dynamic and could provide more flexibility to handle locale with subcodes (eg: fr-CA) and default values.

wdavidw avatar May 01 '19 18:05 wdavidw