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

Extract Parser error with Array.map & join #250

Open
FirmYn opened this issue Nov 16, 2021 · 0 comments
Open

Extract Parser error with Array.map & join #250

FirmYn opened this issue Nov 16, 2021 · 0 comments

Comments

@FirmYn
Copy link

FirmYn commented Nov 16, 2021

Hi,
There is an issue with the extract parser with this code:

  get text(): string {
    const status = this.selectedStatus();
    if (status.length) {
      return status 
        .map(s => this.translateService.instant(s))
        .join(', ');
    } else {
      return this.translateService.instant('DEFAULT_STATUS');
    }
  }

The JSON output for this is:

{
	", ": "",
	"DEFAULT_STATUS": ""
}

It expected result was:

{
	"DEFAULT_STATUS": ""
}

Changing the code to this fix the issue:

  get text(): string {
    const status = this.selectedStatus();
    if (status.length) {
      const translatedStatus = selectedStatus.map(status =>
        this.translateService.instant(status)
      );
      return translatedStatus.join(', ');
    } else {
      return this.translateService.instant('DEFAULT_STATUS');
    }
  }

Also, this.selectedStatus() returns other keys that are marked elsewhere.

@FirmYn FirmYn changed the title Extract Parser error Extract Parser error with Array.map & join Nov 16, 2021
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