funktionswerk / hapi-i18n

Translation module for hapi based on mashpie's i18n module
MIT License
39 stars 22 forks source link

replace onPreHandler by a decorator function that return the i18n #3

Closed yodutouf closed 9 years ago

yodutouf commented 9 years ago

I replace the server.ext('onPreHandler') by a server.decorate as suggested by @Marsup

The server.decorate adds a i18n function to the request.

So, with this update, use request.i18n().('key') while before it was request.i18n.('key')

Marsup commented 9 years ago

To avoid any future conflict, you should put that i18n on this.app, hapi's docs mention explicitly it's the only safe place to put state. Also there's no CI but I doubt the tests will pass with those modifications.