Closed robsonek closed 5 months ago
Try deleting the config/localization.php
file and try again.
I tried to reproduce the problem on a clean application, installing only your dependencies, and the error did not reproduce.
Try deleting the
config/localization.php
file and try again.
I don't have that file
I tried to reproduce the problem on a clean application, installing only your dependencies, and the error did not reproduce.
Please try with pl language. php artisan lang:add pl
I have no errors with the older version of the package
"laravel-lang/publisher": "16.3",
Hm...
Locales ......................................
Installed ......................... en, fr, pl
Protected ................................. en
LaravelLang\Lang\Plugin ............... 15.4.1
Locales Version ........................ 2.8.0
Publisher Version ..................... 16.4.0
The publisher versions 16.3 and 16.4 differ only in working with the configuration file.
I am not able to reproduce the problem, so I need your help.
Go to the vendor/laravel-lang/publisher/src/Processors/Processor.php
file and add a try-catch to the plugins
method, adding the output. It should work like this:
protected function plugins(): array
{
try {
return collect($this->config->getPlugins())
->map(fn (array $plugins) => collect($plugins)
->map(static fn (string $plugin) => new $plugin())
->filter(static fn (Plugin $plugin) => $plugin->has())
->all()
)
->filter()
->all();
} catch (\Throwable $e) {
dd(
$e->getMessage(),
$this->config->getPlugins()
);
}
}
After that, run the console command php artisan lang:update
. As soon as the code drops by error, it will show information about it: the text of the error itself, as well as a list of plugins that caused it.
This way, I can identify the problem spot and fix it.
And also run the console command php artisan about
. It will have a section called Locales
. Send a screenshot of it.
"LaravelLang\Publisher\Processors\Processor::LaravelLang\Publisher\Processors{closure}(): Argument #1 ($plugin) must be of type string, array given" // vendor/laravel-lang/publisher/src/Processors/Processor.php:158 array:1 [ "/Users/..." => array:1 [ "us/vendor/laravel-lang/lang" => array:17 [ 0 => "LaravelLang\Lang\Plugins\Breeze\Master" 1 => "LaravelLang\Lang\Plugins\Breeze\V2" 2 => "LaravelLang\Lang\Plugins\Cashier\Stripe\Master" 3 => "LaravelLang\Lang\Plugins\Cashier\Stripe\V15" 4 => "LaravelLang\Lang\Plugins\Fortify\Master" 5 => "LaravelLang\Lang\Plugins\Fortify\V1" 6 => "LaravelLang\Lang\Plugins\Jetstream\Master" 7 => "LaravelLang\Lang\Plugins\Jetstream\V5" 8 => "LaravelLang\Lang\Plugins\Laravel\Master" 9 => "LaravelLang\Lang\Plugins\Laravel\V11" 10 => "LaravelLang\Lang\Plugins\Nova\DuskSuite\Main" 11 => "LaravelLang\Lang\Plugins\Nova\LogViewer\Main" 12 => "LaravelLang\Lang\Plugins\Nova\V4" 13 => "LaravelLang\Lang\Plugins\Spark\Paddle" 14 => "LaravelLang\Lang\Plugins\Spark\Stripe" 15 => "LaravelLang\Lang\Plugins\UI\Master" 16 => "LaravelLang\Lang\Plugins\UI\V4" ] ] ] // vendor/laravel-lang/publisher/src/Processors/Processor.php:158
php artisan about
on "laravel-lang/publisher": "16.4.0"
Can you execute composer info laravel-lang/config
console command? What do you see?
I realized that the problem with the private configuration file - https://github.com/Laravel-Lang/config/blob/main/config/private.php
But I can't find the problem. I have already created the second test project and it works. My OS is Windows.
yes
name : laravel-lang/config descrip. : The Laravel-Lang config package keywords : Laravel-lang, Settings, config, lang, languages, laravel, locale, locales, localization, localizations, translation, translations versions : * 1.0.2 released : 2024-06-01, this week type : library license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText homepage : source : [git] https://github.com/Laravel-Lang/config.git 48e8efa965dac43984ccc3a4ddc211793c5335dd dist : [zip] https://api.github.com/repos/Laravel-Lang/config/zipball/48e8efa965dac43984ccc3a4ddc211793c5335dd 48e8efa965dac43984ccc3a4ddc211793c5335dd path : /Users/.../vendor/laravel-lang/config names : laravel-lang/config
support issues : https://github.com/Laravel-Lang/config/issues source : https://github.com/Laravel-Lang/config/tree/1.0.2
autoload psr-4 LaravelLang\Config\ => src/
requires archtechx/enums ^1.0 illuminate/config ^10.0 || ^11.0 illuminate/support ^10.0 || ^11.0 laravel-lang/locale-list ^1.4 php ^8.1
requires (dev) orchestra/testbench ^9.1 pestphp/pest ^2.34
But I can't find the problem. I have already created the second test project and it works. My OS is Windows.
I`m using MacOS
php artisan about
on "laravel-lang/publisher": "16.3.0"
I realized that the problem with the private configuration file - https://github.com/Laravel-Lang/config/blob/main/config/private.php
But I can't find the problem. I have already created the second test project and it works. My OS is Windows.
Maybe try installing an older version like I did and update to the latest one once it's set up?
GitHub tests for MacOS is ok too...
https://github.com/Laravel-Lang/publisher/actions/runs/9364921609/job/25778975795
Publishers 16.3 differs from 16.4 in only one PR: https://github.com/Laravel-Lang/publisher/pull/356
Let's try this:
composer remove --dev laravel-lang/lang
rm -rf ./config/localization.php ./config/localization-private.php ./vendor/laravel-lang ./lang ./resources/lang
composer update -W
composer require --dev laravel-lang/lang
php artisan lang:update
The same...
php artisan lang:update
INFO Collecting translations...
TypeError
LaravelLang\Publisher\Processors\Processor::LaravelLang\Publisher\Processors{closure}(): Argument #1 ($plugin) must be of type string, array given
It remains to be seen where the difference comes from:
Your result:
array:1 [
"/Users/..." => array:1 [
"us/vendor/laravel-lang/lang" => array:17 [
0 => "LaravelLang\Lang\Plugins\Breeze\Master"
1 => "LaravelLang\Lang\Plugins\Breeze\V2"
...
My result:
array:1 [
"D:\domains\test2\vendor\laravel-lang\lang" => array:17 [
0 => "LaravelLang\Lang\Plugins\Breeze\Master"
1 => "LaravelLang\Lang\Plugins\Breeze\V2"
...
Can you check if there is a dot anywhere in the path to the vendor\laravel-lang\lang
folder?
Maybe, /User/.../domain.com/vendor/laravel-lang/lang
? (domain.com
)
Yes, that's point.
Path is /Users/<you_hide_this_path>/some.us/vendor/laravel-lang/lang
Yes, I have a dot in path!
Yeah!
I changed path to d:\domains\test2.test
and get the error:
I'll fix that in the near future. Thank you!
Thank you for your support!
Fixed and released: laravel-lang/config#1.0.3
You can update dependency:
composer update laravel-lang/config
Thank you for your report!
PS: Don't forget to undo the changes in vendor/laravel-lang/publisher/src/Processors/Processor.php
file
Or just run the commands:
composer remove --dev laravel-lang/lang
composer require --dev laravel-lang/lang
Everything works with new version. Thank you for the quick help!
You're welcome!
Lang Package Name
laravel-lang/publisher
Lang Package Version
16.4
Laravel Framework Version
11.9.2
PHP Version
8.3.7
Dependencies
Issue description
php artisan lang:update
Steps to reproduce
I don't know. On 16.3 the error don't appear.