nestjs-i18n icon indicating copy to clipboard operation
nestjs-i18n copied to clipboard

feat: Add i18n-context-service to inject custom contexts

Open jurienhamaker opened this issue 2 years ago • 14 comments

Currently I am working on a project that has a custom request scope. Similair how this package provides rpc, graphql & http out of the box. This will allow the user to add custom contexts and functions to get the context of said custom context.

I do need some help with the I18nLang decorator, since I have no clue how I could inject the service into a paramDecorator.

Same for the tests, any suggestions are welcome.

jurienhamaker avatar Aug 18 '22 11:08 jurienhamaker

@toonvanstrijp Have you had any time to look at this yet?

jurienhamaker avatar Sep 02 '22 10:09 jurienhamaker

@jurienhamaker I'll take a look at it right now ;)

toonvanstrijp avatar Sep 02 '22 10:09 toonvanstrijp

Coverage Status

Coverage decreased (-0.8%) to 90.755% when pulling ec910c94da61b31a82e54233972c91d788c54032 on jurienhamaker:feature/custom-context into 8b998ab3da0aee8451adfd3f8d63f7db376231a0 on toonvanstrijp:main.

coveralls avatar Sep 02 '22 11:09 coveralls

@jurienhamaker looks good so far, the only thing that I'm not sure about yet is how to make the I18nLang decorator work.

toonvanstrijp avatar Sep 02 '22 11:09 toonvanstrijp

@jurienhamaker @jurienhamaker alright I have a potential solution. In the i18n-language.interceptor.ts we get the context object and put the i18nService and i18nLang on there. But we can also set things on the nestjs context so: context.i18nCustomContexts (not the ctx one). Then inside the parameterDecorator we can access them by doing context.i18nCustomContexts.

toonvanstrijp avatar Sep 02 '22 12:09 toonvanstrijp

@toonvanstrijp Any updates?

SocketSomeone avatar Mar 18 '23 20:03 SocketSomeone

https://github.com/toonvanstrijp/nestjs-i18n/issues/489 https://github.com/toonvanstrijp/nestjs-i18n/issues/479 related

rubiin avatar Aug 18 '23 11:08 rubiin

@toonvanstrijp can you look on this one on your free time. Since this is older and almost mergeable I would like your input. This will help close few issue

rubiin avatar Aug 21 '23 13:08 rubiin

Hey @toonvanstrijp, can you check this pull request please!? 🙏

sawa-ko avatar Jan 20 '24 14:01 sawa-ko

Or you @rubiin?

sawa-ko avatar Jan 20 '24 14:01 sawa-ko

plz fix the merge conflicts

rubiin avatar Jan 20 '24 14:01 rubiin

can you fix the conflicts and accept the changes to update the version? or can I do this in your pr?

BARTlab avatar Mar 06 '24 12:03 BARTlab

@BARTlab go ahead

rubiin avatar Mar 06 '24 12:03 rubiin