knuckleswtf / scribe

Generate API documentation for humans from your Laravel codebase.✍
https://scribe.knuckles.wtf/laravel/
MIT License
1.7k stars 303 forks source link

Version 4.21 has bug to translate #676

Closed medeiroz closed 1 year ago

medeiroz commented 1 year ago

Scribe version

4.21

PHP version

8.1

Framework

Laravel

Framework version

10.12.0

Scribe config

title => "MS.Indicacao Documenta\u00e7\u00e3o"
base_url => "http://localhost:8888"
type => "laravel"
auth.enabled => true
auth.default => true

What happened?

I ran php artisan scribe:genrate the error "Translation not found for $key. You can add a translation for this in yourlang/scribe.php, but this is likely a problem with the package. Please open an issue." is shown

I rollback to 4.20 and it worked as expected

Docs

brecht-vermeersch commented 1 year ago

We have the same issue

shalvah commented 1 year ago

Do you use custom views or something? Did you publish the previous translation files? Also see the changelog https://github.com/knuckleswtf/scribe/blob/master/CHANGELOG.md#4210-29-may-2023 and the docs on localisation https://scribe.knuckles.wtf/laravel/advanced/localization

shalvah commented 1 year ago

Also, can you share the exact exception that was thrown? This isn't the actual message.

ccec1t91077 commented 1 year ago

I did some trace, it might be a environment issue.

The $this->app->runningInConsole() here will return false in some case, and it will trying to use default loader instead of the CustomTranslationsLoader, then the error will thrown by this line.

shalvah commented 1 year ago

Hmm, interesting. Are you using Laravel Octane? How are you running the generate command?

shalvah commented 1 year ago

Okay, I think I've found a fix. Can you guys try with the master branch now? composer require --dev knuckleswtf/scribe:dev-master should be enough.

JonPurvis commented 1 year ago

Also had the same issue, rolled back to 4.20 for now. Definitely an environment thing though as it worked fine in dev but only errored during our production deployment.

bmbBAMBUS commented 1 year ago

I had the same issue, I can cofirm that dev-master works.

shalvah commented 1 year ago

Fixed in 4.21.1

JonPurvis commented 1 year ago

Thanks @shalvah 👍