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

Keys used in pipes or other .ts files only are reported as missing #147

Open
grackeon opened this issue Nov 16, 2022 · 5 comments
Open

Keys used in pipes or other .ts files only are reported as missing #147

grackeon opened this issue Nov 16, 2022 · 5 comments

Comments

@grackeon
Copy link

Bug report

Describe the bug

If a translation key is only used in pipes or .ts classes of the component (so complex logic is not included in the view directly), the linting treats the key as missing.

ngx-translate-lint@1.11.0 works fine.
ngx-translate-lint@1.20.4 shows error that keys don't exist in project.

To Reproduce

Steps to reproduce the behavior:

  • Add a basic pipe to the project and use it in any view:
@Pipe({
  name: 'somePipe'
})

@Injectable()
export class SomePipe implements PipeTransform {
  constructor(private translateService: TranslateService) {
  }

  transform(value): string {
    return this.translateService.instant('key1');
  }
}
  • Add key1 to the translation file.
  • Execute ngx-translate-lint
  • Linting fails with error: Key: 'key1' doesn't exist in project'

Expected behavior

Linting should not treat keys as not-existing if they are used in pipes or other methods of *.component.ts files.

@itekaf
Copy link
Owner

itekaf commented Nov 16, 2022

Hi @Moritz1409

It's the same as previous bag (#146)

I think the main problem is on flag --deepSearch. In previous versions, logic (from ---deepSearch) was included in the main flow. But I created a separate flag, because that logic works slowly (on big projects). Right now this flag is disable by default.

Could you pls enable this flag and check result?

@grackeon
Copy link
Author

This also works as before with --deepSearch being enabled. Thanks again!

@itekaf
Copy link
Owner

itekaf commented Nov 17, 2022

Hi @Moritz1409 thanks for quick answer, :) I try to resolve your issue without this flag in the future.

Have a nice day

@julianpoy
Copy link

@svoboda-rabstvo --deepSearch enabled takes far longer to run compared to the older versions before this flag existed. I see a 3x increase in time in comparison to version 1.14.1.

Unfortunately without the --deepSearch flag enabled, I get the same issue as the original issue poster.

@itekaf
Copy link
Owner

itekaf commented Dec 17, 2023

@julianpoy Yes, you're absolutely right. I'm working on it right now :) When I have update I will write here

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

No branches or pull requests

3 participants