Missing keys after lang:add XX
misog opened this issue · 5 comments
Environment
- Laravel-Lang Publisher Version: v14.7.0
- Laravel Version: v9.52.14
- PHP Version: 8.2.1
Issue description
When I add php artisan lang:add de
or php artisan lang:add es
or any other language then validation.php
is created however keys are missing. There are no translations of validation errors etc... Here is the file:
<?php
declare(strict_types=1);
return [
'attributes' => [
'address' => 'Adresse',
'age' => 'Alter',
'amount' => 'Höhe',
'area' => 'Gebiet',
'available' => 'Verfügbar',
'birthday' => 'Geburtstag',
'body' => 'Körper',
'city' => 'Stadt',
'content' => 'Inhalt',
'country' => 'Land',
'created_at' => 'Erstellt am',
'creator' => 'Ersteller',
'current_password' => 'Derzeitiges Passwort',
'date' => 'Datum',
'date_of_birth' => 'Geburtsdatum',
'day' => 'Tag',
'deleted_at' => 'Gelöscht am',
'description' => 'Beschreibung',
'district' => 'Bezirk',
'duration' => 'Dauer',
'email' => 'E-Mail-Adresse',
'excerpt' => 'Auszug',
'filter' => 'Filter',
'first_name' => 'Vorname',
'gender' => 'Geschlecht',
'group' => 'Gruppe',
'hour' => 'Stunde',
'image' => 'Bild',
'last_name' => 'Nachname',
'lesson' => 'Lektion',
'line_address_1' => 'Adresszeile 1',
'line_address_2' => 'Adresszeile 2',
'message' => 'Nachricht',
'middle_name' => 'Zweitname',
'minute' => 'Minute',
'mobile' => 'Handynummer',
'month' => 'Monat',
'name' => 'Name',
'national_code' => 'Länderkennung',
'number' => 'Nummer',
'password' => 'Passwort',
'password_confirmation' => 'Passwortbestätigung',
'phone' => 'Telefonnummer',
'photo' => 'Foto',
'postal_code' => 'Postleitzahl',
'price' => 'Preis',
'province' => 'Provinz',
'recaptcha_response_field' => 'Captcha-Feld',
'remember' => 'Erinnern',
'restored_at' => 'Wiederhergestellt am',
'result_text_under_image' => 'Ergebnistext unter Bild',
'role' => 'Rolle',
'second' => 'Sekunde',
'sex' => 'Geschlecht',
'short_text' => 'Kurzer Text',
'size' => 'Größe',
'state' => 'Bundesland',
'street' => 'Straße',
'student' => 'Schüler/Student',
'subject' => 'Gegenstand',
'teacher' => 'Lehrer',
'terms' => 'Bedingungen',
'test_description' => 'Test Beschreibung',
'test_locale' => 'Test Region',
'test_name' => 'Testname',
'text' => 'Text',
'time' => 'Uhrzeit',
'title' => 'Titel',
'updated_at' => 'Aktualisiert am',
'username' => 'Benutzername',
'year' => 'Jahr',
],
];
Steps to reproduce
php artisan lang:add es
- validation.php is created with missing keys
What version of the laravel-lang/lang
package is installed in the project? Or are you using the laravel-lang/common
package?
Apparently, you installed new versions of packages without checking them against the compatibility table.
Write your versions and I can tell you exactly what needs to be done to solve the problem.
I installed it like this:
composer require laravel-lang/common --dev
In composer.lock I have laravel-lang/lang of version 13.2.2
Also
Laravel-Lang Publisher Version: v14.7.0
Laravel Version: v9.52.14
PHP Version: 8.2.1
Also we are using non-standard architecture of Laravel. So if Pubisher automatically detects needed translations maybe this could be the problem.
I see what the problem is. The "laravel-lang/common" package is not strictly tied to the version of the framework, so you installed it without any problems.
Thus, the "laravel-lang/lang" package version 13.2.2 was installed, and it does not contain translations for Laravel 9 (you can check the compatibility table).
To solve this problem, run the console commands:
composer remove laravel-lang/common --dev
composer require laravel-lang/common:^3.0 --dev
Thank you, it is working now. This could be documented for other people.
This problem is encountered when installing older versions. I have released a fix that will install the correct version and get rid of the error.