Bottelet / translation-checker

find translations you forgot to add to your language files, check, and maintain translations in yor Laravel application
MIT License
90 stars 6 forks source link

Translations check fails #14

Open open-soft-app opened 3 days ago

open-soft-app commented 3 days ago

When the check function (php artisan translations:check en) encounters this type of line of code: echo $level == 'error' ? 'Whoops!' : {{trans('email.hello')}}, "\n\n";

The library fails:

 Error parsing file C:\.......\resources\views\..........\email-plain.blade.php: Syntax error, unexpected '{' on line 6

  at vendor\bottelet\translation-checker\src\Extractor\PhpBaseClassExtractor.php:53
     49▕                 return [];
     50▕             }
     51▕             $traverser->traverse($ast);
     52▕         } catch (Exception $error) {
  ➜  53▕             throw new RuntimeException("Error parsing file {$file->getRealPath()}: {$error->getMessage()}");
     54▕         }
     55▕
     56▕         return array_merge(
     57▕             $this->translationKeys,

  1   vendor\bottelet\translation-checker\src\Finder\MissingKeysFinder.php:26
      Bottelet\TranslationChecker\Extractor\PhpBaseClassExtractor::extractFromFile(Object(SplFileInfo))

  2   vendor\bottelet\translation-checker\src\Finder\MissingKeysFinder.php:49
      Bottelet\TranslationChecker\Finder\MissingKeysFinder::findTranslatableStrings()
Bottelet commented 2 days ago

Thanks for letting me know! I'll try and fix it over the weekend.