toonvanstrijp / nestjs-i18n

The i18n module for nestjs.
https://nestjs-i18n.com
Other
625 stars 102 forks source link

Read a json value from hbs without controller ==> Error: Missing helper: "t" at Object. #593

Open aelharrak opened 8 months ago

aelharrak commented 8 months ago

Describe the bug

Hello team, When I try to use hbs, nestjs-i18n with the following implementation:

i got this errror Error: Missing helper: "t" at Object. there is maner to fix this error please ?

Note: i don't need Controllers to set the value, just read the json value from hbs

Reproduction

Error: Missing helper: "t" at Object.

System Info

**app.module.ts**
`
@Module({
  imports: [
    I18nModule.forRoot({
      fallbackLanguage: 'en',
      loaderOptions: {
        path: path.join(__dirname, '/i18n/'),
        watch: true,
      },
      resolvers: [
[hbs_i18n_nestJS.tar.gz](https://github.com/toonvanstrijp/nestjs-i18n/files/13171440/hbs_i18n_nestJS.tar.gz)

        {use: QueryResolver, options: ['lang']},
        AcceptLanguageResolver,
      ],
      viewEngine: 'hbs'
    }),`

**.nest-cli.json**
`{
  "$schema": "https://json.schemastore.org/nest-cli",
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "deleteOutDir": true,
    "assets": [
      {
        "include": "i18n/**/*",
        "watchAssets": true,
        "outDir": "./dist"
      }
    ]
  }
}
`
**test.json**
`{
  "HELLO": "Hello", ...
}
`

**.hbs**
` {{ t 'test.HELLO' }}`

otherwise there is any git example link ?

Used Package Manager

npm

Validations

aelharrak commented 8 months ago

Please find out my source code

hbs_i18n_nestJS.tar.gz