toonvanstrijp / nestjs-i18n

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

> Hi, @toonvanstrijp I tried this approach but for some reason path parameters are not parsed in resolver. I try to read in resolver #635

Closed erickalmeidaptc closed 2 months ago

erickalmeidaptc commented 6 months ago
          > Hi, @toonvanstrijp I tried this approach but for some reason path parameters are not parsed in resolver. I try to read in resolver
 const request = context.switchToHttp().getRequest();
    const { localeId } = request.params;

and have this route

RouterModule.register([
      {
        path: ':localeId',
        children: [
          {
            path: 'localization',
            module: LocalizationModule,
          },

but in resolver request.params is

{ '0': 'en-US/localization/getHello' }

instead of

{ 'localeId': 'en-US }

Same with me. I'm using "nestjs-i18n": "10.4.5".

I have two path params and instead of receiving a list, I'm receiving only one parameter. It started happening when I upgraded to the latest version. image

Originally posted by @erickalmeidaptc in https://github.com/toonvanstrijp/nestjs-i18n/issues/168#issuecomment-2096313238

erickalmeidaptc commented 6 months ago

After disabling the Middleware it's back to working. image

AppModule:

    I18nModule.forRootAsync({
      useFactory: (configService: ConfigService) => ({
        fallbackLanguage: configService.get('FALLBACK_LANGUAGE', 'en-gb'),
        disableMiddleware: true,
        loaderOptions: {
          path: path.join(__dirname, '/i18n/'),
          watch: true,
        },
      }),
      resolvers: [{ use: URLResolver, options: [] }],
      inject: [ConfigService],
    }),
rubiin commented 2 months ago

Closing as resolved