Mailer
To use nestjs-i18n
with the @nestjs-modules/mailer package, you'll need to register the helper function like this:
src/app.module.ts
@Module({
imports: [
I18nModule.forRoot(...I18nOptions),
MailerModule.forRootAsync({
inject: [ I18nService ],
useFactory: (i18n: I18nService) => ({
transport: {
...
},
template: {
dir: path.join(__dirname, '../resources/templates/'),
adapter: new HandlebarsAdapter({ t: i18n.hbsHelper })
},
})
}),
]
})
danger
This only works if you're using the HandlebarsAdapter
. If you're using a different adapter good luck... 🤞