knuckleswtf / scribe

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

Localization is not working #671

Closed ccec1t91077 closed 1 year ago

ccec1t91077 commented 1 year ago

Scribe version

4.19.1

PHP version

8.2.5

Framework

Laravel

Framework version

10.12.0

Scribe config

------ SAME AS DEFAULT CONFIG ------

What happened?

Localization is not working, translations always using json from /vendor/knuckleswtf/scribe/lang/en.json.

Steps To Reproduce

  1. create project laravel/laravel test-project
  2. Setup Laravel .env
  3. composer require --dev knuckleswtf/scribe
  4. php artisan vendor:publish --tag=scribe-translations
  5. Modify the /lang/vendor/scribe/en.json make some changes of defaults
  6. php artisan scribe:generate
  7. Check the doc it generated, not using the /lang/vendor/scribe/en.json to generate
  8. Move the lang folder inside resources
  9. php artisan scribe:generate
  10. Check the doc it generated, not using the /resources/lang/vendor/scribe/en.json to generate

I met #657 this week. After upgrade to 4.19.1 this issue shows up.

Seems like it won't try to load localization from the published path.

Docs

shalvah commented 1 year ago

This whole thing is a mess. .php translation files and .json translation files have different behaviours, and interact with your app differently. Laravel 10 also changed the default location of translation files, and the publish path as well.

shalvah commented 1 year ago

Fixed in #673