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

Blade Extractor improvement for Laravel 8/Jetstream (Gettext 4.x branch) #261

Merged
merged 2 commits into from
Nov 18, 2020
Merged

Conversation

MichaelHoste
Copy link
Contributor

@MichaelHoste MichaelHoste commented Sep 15, 2020

In a new Laravel 8 Jetstream project (created with laravel new [name] --jet), there is an exception when using Extractors\Blade::fromFile($file, $translations);

  Unable to locate a class or view for component [jet-input].

  at vendor/laravel/framework/src/Illuminate/View/Compilers/ComponentTagCompiler.php:273
    269▕         if ($viewFactory->exists($view = $this->guessViewName($component))) {
    270▕             return $view;
    271▕         }
    272▕ 
  ➜ 273▕         throw new InvalidArgumentException(
    274▕             "Unable to locate a class or view for component [{$component}]."
    275▕         );
    276▕     }
    277▕ 

      +2 vendor frames 
  3   [internal]:0
      Illuminate\View\Compilers\ComponentTagCompiler::Illuminate\View\Compilers\{closure}(["<x-jet-input type="password" class="mt-1 block w-3/4" placeholder="Password"
                                x-ref="password"
                                wire:model.defer="password"
                                wire:keydown.enter="logoutOtherBrowserSessions" />", "jet-input", " type="password" class="mt-1 block w-3/4" placeholder="Password"
                                x-ref="password"
                                wire:model.defer="password"
                                wire:keydown.enter="logoutOtherBrowserSessions" ", " type="password" class="mt-1 block w-3/4" placeholder="Password"
                                x-ref="password"
                                wire:model.defer="password"
                                wire:keydown.enter="logoutOtherBrowserSessions" ", "="logoutOtherBrowserSessions""])

It seems to be unable to locate the jet components, and therefore can't compile the Blade file to PHP.

i don't exactly know why it breaks, but a lot of things are recently updated regarding ComponentTag namespaces and it might be related to this error? (cf. laravel/framework@7cc120e).

However, if I'm right, the Blade extractor doesn't need to compile ComponentTag to do its job correctly, so I created this pull request to always disable it, so that the 4.x branch could still work with Laravel 8/Jetstream.

i hope that makes sense!

@MichaelHoste
Copy link
Contributor Author

@oscarotero Do you think you could consider merging this small pull request in a new GetText 4.x release?

It seems that Blade component tags trigger an error when parsed by GetText (Unable to locate a class or view for component). It's problematic for most Laravel 8 projects.

Or maybe it should work without this pull request and I'm doing something wrong?

(FYI The tests actually pass, but travis bugged on one of them)

@oscarotero oscarotero merged commit fbdee7a into php-gettext:4.x Nov 18, 2020
@oscarotero
Copy link
Member

Ok. (sorry I missed this pull request).
Thanks!

@MichaelHoste
Copy link
Contributor Author

Thank you very much for accepting this pull request, and also for this nice project! 😄

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

Successfully merging this pull request may close these issues.

None yet

2 participants