toonvanstrijp / nestjs-i18n

The i18n module for nestjs.
https://nestjs-i18n.com
Other
642 stars 106 forks source link

How to use HeaderResolver to automatically recognize the language from header? #500

Closed RezDev94 closed 1 year ago

RezDev94 commented 1 year ago

I'm using this resolver new HeaderResolver(['x-lang'])

but when I use the translate method It's not returning the correct translation, It always returns the translation with the fallback language.

this.i18n.translate('test.hello');

So should I always pass the lang parameter to translate method?

rubiin commented 1 year ago

Are you sure you are using the library correctly. and

rubiin commented 1 year ago

https://github.com/toonvanstrijp/nestjs-i18n/tree/main/samples/dto-validation . Here is the example app used