Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
5 tasks done
aelharrak opened this issue Oct 25, 2023 · 1 comment
Open
5 tasks done

Comments

@aelharrak
Copy link

aelharrak commented Oct 25, 2023

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

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@aelharrak aelharrak changed the title Error: Missing helper: "t" at Object. Read a json value from hbs without controller ==> Error: Missing helper: "t" at Object. Oct 25, 2023
@aelharrak
Copy link
Author

Please find out my source code

hbs_i18n_nestJS.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant