vendure-ecommerce / ngx-translate-extract

Extract translatable (using ngx-translate) strings and save as a JSON or Gettext pot file
MIT License
51 stars 19 forks source link

SyntaxError: Expected double-quoted property name in JSON at position 959 #36

Closed marcguillemdev closed 4 months ago

marcguillemdev commented 10 months ago

The following error is displayed when executing the i18n:extract command:

I have been checking different files until I found the cause and it is the following class:

import { MatPaginatorIntl } from '@angular/material/paginator';

export class PaginatorIntl implements MatPaginatorIntl {

}

If I import the class "MatPaginatorIntl" and implement it as in the example above, the error is displayed. If I remove the import or do not implement it the error disappears. I don't know why this is happening, maybe the JSON compiler is misinterpreting the file or I don't know what could be going on.

To reproduce the error just run the following command on the above class: ngx-translate-extract --input ./paginator-intl.ts --output ./src/assets/i18n/error_reproduce.json --clean --format json

Angular version: 16 ngx-translate version-extract: 8.3.0

pmpak commented 10 months ago

This might be the same as #24 which was addressed in #30. Since you are using Angular 16, could you try installing v8.2.1 and see if that works?

marcguillemdev commented 10 months ago

@pmpak thanks for your response. It works with version 8.2.1, but why doesn't it work on the latest version 8.3.0? In the readme it clearly says that we need v8x for Angular 13 to 16, that's why I chose the latest v8.

michaelbromley commented 10 months ago

Hi @pmpak, I guess there was a regression introduced somewhere between 8.2.1 -> 8.3.0? If 8.2.1 is working for you, I'd advise to just stick with that.