File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Module } from '@nestjs/common' ;
2+ import { DatabaseModule } from '../../infrastructure/database/typeorm/database.module' ;
3+ import { ConfigModule , ConfigService } from '@nestjs/config' ;
4+ import { RecipeModule } from './recipe.module' ;
5+ import { UserModule } from './user.module' ;
6+ import { APP_GUARD } from '@nestjs/core' ;
7+ import { JwtAuthGuard } from '../../infrastructure/auth/jwt/jwt.guard' ;
8+ import { AuthModule } from './auth.module' ;
9+ import { AcceptLanguageResolver , I18nModule , QueryResolver } from 'nestjs-i18n' ;
10+ import * as path from 'path' ;
11+
12+ @Module ( {
13+ imports : [
14+ AuthModule ,
15+ DatabaseModule ,
16+ RecipeModule ,
17+ UserModule ,
18+ ConfigModule . forRoot ( {
19+ isGlobal : true ,
20+ } ) ,
21+ I18nModule . forRootAsync ( {
22+ useFactory : ( configService : ConfigService ) => ( {
23+ fallbackLanguage : configService . get ( 'LANGUAGE' ) ,
24+ loaderOptions : {
25+ path : path . join ( __dirname , '../../infrastructure/i18n' ) ,
26+ } ,
27+ } ) ,
28+ inject : [ ConfigService ] ,
29+ resolvers : [
30+ { use : AcceptLanguageResolver , options : [ 'accept-language' ] } ,
31+ new QueryResolver ( [ 'lang' ] ) ,
32+ new AcceptLanguageResolver ( ) , // <- NORMALIZA en-US → en
33+ ] ,
34+ } ) ,
35+ ] ,
36+ providers : [
37+ {
38+ provide : APP_GUARD ,
39+ useClass : JwtAuthGuard ,
40+ } ,
41+ ] ,
42+ } )
43+ export class AppModule { }
You can’t perform that action at this time.
0 commit comments