mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 19:46:42 +02:00
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:
parent
9b01c094c1
commit
fd30fdc620
1 changed files with 3 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { Module, DynamicModule, Global } from '@nestjs/common';
|
import { Module, DynamicModule } from '@nestjs/common';
|
||||||
import { ConfigModule } from '@nestjs/config';
|
import { ConfigModule } from '@nestjs/config';
|
||||||
import { I18nService, I18N_OPTIONS } from './i18n.service';
|
import { I18nService, I18N_OPTIONS } from './i18n.service';
|
||||||
import { I18nOptions } from './types';
|
import { I18nOptions } from './types';
|
||||||
|
|
@ -28,7 +28,6 @@ import { I18nOptions } from './types';
|
||||||
* })
|
* })
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Global()
|
|
||||||
@Module({})
|
@Module({})
|
||||||
export class I18nModule {
|
export class I18nModule {
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,6 +36,7 @@ export class I18nModule {
|
||||||
static forRoot(options?: I18nOptions): DynamicModule {
|
static forRoot(options?: I18nOptions): DynamicModule {
|
||||||
return {
|
return {
|
||||||
module: I18nModule,
|
module: I18nModule,
|
||||||
|
global: true,
|
||||||
imports: [ConfigModule],
|
imports: [ConfigModule],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
|
|
@ -59,6 +59,7 @@ export class I18nModule {
|
||||||
}): DynamicModule {
|
}): DynamicModule {
|
||||||
return {
|
return {
|
||||||
module: I18nModule,
|
module: I18nModule,
|
||||||
|
global: true,
|
||||||
imports: [...(options.imports || []), ConfigModule],
|
imports: [...(options.imports || []), ConfigModule],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue