📝Inject Service
There are situations where you will need to translate your texts within the service
.
{
"hello": "Hello World"
}
import { Injectable } from '@nestjs/common';
import { LocaleService } from '@/core/i18n/i18n.service';
@Injectable()
export class AppService {
constructor(private readonly localeService: LocaleService) {}
getHello(): string {
return this.localeService.translate('hello');
} // output: Hello World
}
Simply you can inject the
service
fromlocale
and translate your texts.
Last updated