fix(bot-services): add global: true to I18nModule dynamic module config

The @Global() decorator on a module class doesn't apply when using
dynamic modules (forRoot/forRootAsync). The global: true property
must be set directly in the DynamicModule return object.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-02-17 12:48:28 +01:00
parent 9b01c094c1
commit fd30fdc620

View file

@ -1,4 +1,4 @@
import { Module, DynamicModule, Global } from '@nestjs/common';
import { Module, DynamicModule } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { I18nService, I18N_OPTIONS } from './i18n.service';
import { I18nOptions } from './types';
@ -28,7 +28,6 @@ import { I18nOptions } from './types';
* })
* ```
*/
@Global()
@Module({})
export class I18nModule {
/**
@ -37,6 +36,7 @@ export class I18nModule {
static forRoot(options?: I18nOptions): DynamicModule {
return {
module: I18nModule,
global: true,
imports: [ConfigModule],
providers: [
{
@ -59,6 +59,7 @@ export class I18nModule {
}): DynamicModule {
return {
module: I18nModule,
global: true,
imports: [...(options.imports || []), ConfigModule],
providers: [
{