Aller-Couleur / handlebars-i18n

handlebars-i18next.js adds the internationalization features of i18next and Intl to handlebars.js
Other
16 stars 6 forks source link

not working with handlebars: 4.7.8 #74

Closed mkgn closed 2 weeks ago

mkgn commented 2 months ago

I have 4.7.8 version of handlebars as my viewengine in NestJS application. with that i can't configure i18nService. Why is that?

Handlebars 4.7.8 exports it as "handlebars" so ideally i should use

import Handlebars from 'handlebars';
//other code
I18nModule.forRootAsync({ //https://github.com/toonvanstrijp/nestjs-i18n/pull/609
  useFactory: (configService: ConfigService) => ({
    fallbackLanguage: 'en',
    loaderOptions: {
      path: path.join(__dirname, '/i18n/'),
      watch: true,
    },
    viewEngine: 'handlebars' //value "handlebars" here not working??
  }),
  resolvers: [AcceptLanguageResolver],
  inject: [ConfigService],
}),

However in i18n configuration viewEngine parameter only accepts hbs,ejs and pug. What may be the issue?
fwalzel commented 2 months ago

Apologies, I am not very familiar with NestJS. I can't see in your code snippet where handlebars-i18n comes into play. Is handlebars-i18n wrapped in the instance of the I18nModule? Please provide information, how you instantiate and use handlebars-i18n.