11import { ExecutionContext , Injectable } from '@nestjs/common' ;
2- import { I18N_OPTIONS , I18nOptions , I18nService } from 'nestjs-i18n' ;
32import { ModuleRef } from '@nestjs/core' ;
3+ import { I18nOptions , I18nService , I18N_OPTIONS } from 'nestjs-i18n' ;
44import { CLS_RESOLVERS , CLS_TRANSLATION_NAMESPACE , DEFAULT_LANGUAGE_KEY , PRIORITY_LANGUAGE_GETTER } from '../constants' ;
5- import { LanguageKeyMap , TranslateOptions } from '../types' ;
65import { ClsResolver } from '../interfaces' ;
6+ import { LanguageKeyMap , TranslateOptions } from '../types' ;
77
88@Injectable ( )
99export class TranslationService {
@@ -14,7 +14,10 @@ export class TranslationService {
1414 private defaultLanguageKey : string ;
1515 private priorityLanguageGetter : ( ) => string ;
1616
17- constructor ( private i18nService : I18nService , private moduleRef : ModuleRef ) {
17+ constructor (
18+ private i18nService : I18nService < Record < string , string > > ,
19+ private moduleRef : ModuleRef
20+ ) {
1821 TranslationService . instance = this ;
1922 this . clsResolvers = this . moduleRef . get ( CLS_RESOLVERS , { strict : false } ) ;
2023 this . i18nOptions = this . moduleRef . get ( I18N_OPTIONS , { strict : false } ) ;
@@ -35,7 +38,7 @@ export class TranslationService {
3538 options . lang = this . getCurrentLanguage ( ) ;
3639 }
3740
38- return this . i18nService . translate < string > ( key , options ) ;
41+ return this . i18nService . translate ( key , options ) ;
3942 }
4043
4144 getDefaultLanguageKey ( ) {
0 commit comments