funktionswerk / hapi-i18n

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

src: enable to custom check language by header's key #5

Closed imshadowz closed 8 years ago

imshadowz commented 8 years ago

enable hapi-i18n to add custom language key in request’s headers

codeva commented 8 years ago

Thanks for the pull request.

Can you please extend the unit tests to check the request header's language code? It should look similar to the one that I have written for the path parameter language code: https://github.com/codeva/hapi-i18n/blob/master/test/test.js#L131-L144

Also I think that the language code in the path parameter should override the language code in the request header since the path parameter is more explicit. This should also be tested to avoid unwanted side effects.

imshadowz commented 8 years ago

Thanks for response.

I will write a unit test soon.

imshadowz commented 8 years ago

@codeva I just write a unit test for this feature.

codeva commented 8 years ago

I have added a new pull request here: https://github.com/codeva/hapi-i18n/pull/6 I have renamed the plugin option to languageHeaderField and added some more tests. Can you please check if the changes are ok for you?