See the documentation for detailed installation.
We also have official chats in Telegram.
Please see CONTRIBUTING for details.
❤️ Laravel Lang? Please consider supporting our collective on Boosty.
This package is licensed under the MIT License.
Publisher provides functionality for working with application localization
Home Page: https://laravel-lang.com
License: MIT License
See the documentation for detailed installation.
We also have official chats in Telegram.
Please see CONTRIBUTING for details.
❤️ Laravel Lang? Please consider supporting our collective on Boosty.
This package is licensed under the MIT License.
Email-Validation with a wrong email leads to the following error message in German:
"E-mail-adresse muss eine gültige E-Mail-Adresse sein."
As visible the first automatically replaced "E-mail-adresse" has the wrong casing - should be written like the latter "E-Mail-Adresse" with upper cases.
In older versions of laravel-lang the attributes have been replaced with ":attribute" and correct casing in the validation.php attribute list 'email' => 'E-Mail-Adresse'. In the current version it is done with ":Attribute" and 'email' => 'e-mail-adresse', what finally results in the capital first letter (which I guess is a laravel feature thats not documented?!)
The question is now: is it a Bug in laravel-lang, or in laravels localization feature? For all other attributes this migth be ok, but I guess there are more cases where a dash is used!?
Since the official laravel installation doesn't use :attribute I'd prefer the old solution...
just validate with german translation file
How to install italian locale?
I have installed both
"laravel-lang/lang": "~8.0",
"laravel-lang/publisher": "^11.1",
I want to simply install/expose/use italian localizations
I am not able to do understand how to do
I also tried a locale:add it
but it creates new empty file for italian locales
I tried also running locale:update
but nothing changes
Browser
In think publisher docs were merged into package docs, but the subdomain throws a 404 now.
I don't quite understant what I am doing wrong.
Laravel Framework 5.7.28
vagrant@homestead:~/code/ce$ composer require andrey-helldar/laravel-lang-publisher --dev
Using version ^1.2 for andrey-helldar/laravel-lang-publisher
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for andrey-helldar/laravel-lang-publisher ^1.2 -> satisfiable by andrey-helldar/laravel-lang
-publisher[v1.2.0, v1.2.1].
- Can only install one of: caouecs/laravel-lang[dev-laravel58, 3.0.62].
- Can only install one of: caouecs/laravel-lang[dev-laravel58, 3.0.62].
- Can only install one of: caouecs/laravel-lang[dev-laravel58, 3.0.62].
- Conclusion: install caouecs/laravel-lang dev-laravel58
- Installation request for caouecs/laravel-lang (locked at 3.0.62, required as ~3.0) -> satisfiable by caouecs/laravel-lang[3.0.62].
This program don't translate laravel breeze keys.
If i want use laravel breeze instead laravel jetstream (with fortify), the keys aren't translated
laravel new my-project
cd my-project
composer require laravel/breeze --dev
php artisan breeze:install
, then npm install
, npm run dev
, php artisan migrate
.composer require andrey-helldar/laravel-lang-publisher --dev
php artisan lang:add es
es
in config/app.php
register
for example (This view is not translate)i guess laravel breeze uses translations from laravel jestream and that's the reason why it doesn't work.
For example, when using command php artisan lang:reset
, you need to reset the translation files to the default state.
The implementation of two methods is planned:
php artisan lang:reset --full
- full reset to default values;php artisan lang:reset
- saving excluded keys specified in the configuration.If no values are passed when running the console command for installing localizations, then list the console with a choice of languages to install.
Some projects uses iso locales, for example en_US
, ca_ES
or even en_GB.utf8
(don't ask) etc. For such locales publisher provides empty files...
May be it should fallback to the known locale?
Replace
'vendor' => base_path('vendor/caouecs/laravel-lang'),
to
'vendor' => base_path('vendor/laravel-lang/lang'),
in the config/lang-publisher.php
file of your app, or delete this key, then run composer update
It would be nice, if the publishing path could be adjusted / configured.
Use-case: Laravel 9 now defaults to "/lang" instead of "/resources/lang" and it would be nice to have the language files in one place. Otherwise i have to remove the "/lang" folder on a fresh install, because laravel will select "/resources/lang".
Thank you!
Recently I installed Laravel Lang with Publisher and added the Italian language using the command php artisan lang:add it
and worked like a charm, after installing it I've edited my composer.json
to run this language on post-root-package-install
script and php artisan lang:update
on post-update-cmd
script.
Today I needed to install Pest, after the package installation, the update failed when reaching the Italian language with this error:
INFO LaravelLang\Attributes\Plugin.
Collect source .......................................................................................................................... 4ms DONE
Collecting en ........................................................................................................................... 2ms DONE
ArgumentCountError
Too few arguments to function it(), 0 passed in D:\git\sms-crm\vendor\dragon-code\support\src\Instances\Call.php on line 181 and at least 1 expected
at D:\git\sms-crm\vendor\pestphp\pest\src\Functions.php:110
106▕ * a closure that contains the test expectations.
107▕ *
108▕ * @return TestCall|TestCase|mixed
109▕ */
➜ 110▕ function it(string $description, Closure $closure = null): TestCall
111▕ {
112▕ $description = sprintf('it %s', $description);
113▕
114▕ return test($description, $closure);
1 D:\git\sms-crm\vendor\dragon-code\support\src\Instances\Call.php:181
it()
2 D:\git\sms-crm\vendor\dragon-code\support\src\Facades\Facade.php:29
DragonCode\Support\Instances\Call::value("it")
This error is thrown every time the command php artisan lang:update
is executed.
php artisan lang:add it
;php artisan lang:update
.In addition to copying php files of locales, you also need to copy json files while maintaining the functionality of prohibiting changes to some keys.
Note: this is not a "bug" but when I click on "Questions & Other" there is a 404 error
I've try to create a plugin for the common language terms i use in my applications "Generic term translations for Laravel"
But when I add the files through the publisher, they are well copied, but contain empty arrays.
I only used PHP files whether in the "source" and "locales" directories.
I wonder if it's the absence of a .json file that causes this or just an oversight on my part or a bad way of doing it.
Maybe there is a plugin development tool to generate the necessary, I know there is the plugin template but I want to start from scratch to better understand the mechanisms.
Install the package:
composer require forxer/generic-term-translations-for-laravel --dev
Run:
php artisan lang:update
Ps: I had already installed before laravel-lang/common
I've install Lang publisher, set the lang and all work great. But thrice a minute in the laravel.log appear the messages:
local.ERROR: Constant expression contains invalid operations {"exception":"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Constant expression contains invalid operations at .../vendor/laravel-lang/publisher/src/Helpers/Config.php:30)
[stacktrace]
#0 {main}
"}
Just install the publisher and set the lang.
Hi guys. I was download Russian language for Laravel JetStream. How to accept this language?
https://github.com/andrey-helldar/laravel-lang-publisher#laravel-jetstream
When updating languages, the package overwrites the key values with the new ones.
I plan to add the ability to protect such keys from being overwritten.
After using php artisan lang:update
the package breakes the dot notation in the validation.php
in the attributes
array and converts it into an array.
Here is my attributes
array:
<?php
return [
'attributes' => [
'timeplan.monday.0.0' => 'Monday (from)',
'timeplan.monday.0.1' => 'Monday (to)',
'timeplan.monday.1.0' => 'Monday (from)',
'timeplan.monday.1.1' => 'Monday (to)',
'timeplan.monday.2.0' => 'Monday (from)',
'timeplan.monday.2.1' => 'Monday (to)',
'timeplan.monday.3.0' => 'Monday (from)',
'timeplan.monday.3.1' => 'Monday (to)',
'timeplan.monday.4.0' => 'Monday (from)',
'timeplan.monday.4.1' => 'Monday (to)',
]
];
After using php artisan lang:update
the attributes array becomes this:
<?php
return [
'attributes' => [
'timeplan' => [
'monday' => [
'0' => [
'0' => 'Monday (from)',
'1' => 'Monday (to)',
],
'1' => [
'0' => 'Monday (from)',
'1' => 'Monday (to)',
],
'2' => [
'0' => 'Monday (from)',
'1' => 'Monday (to)',
],
'3' => [
'0' => 'Monday (from)',
'1' => 'Monday (to)',
],
'4' => [
'0' => 'Monday (from)',
'1' => 'Monday (to)',
],
],
]
]
];
Now laravel gives me an error because the field is an array and not a string.
mb_strtoupper(): Argument #1 ($string) must be of type string, array given
at vendor/laravel/framework/src/Illuminate/Support/Str.php:902
898▕ * @return string
899▕ */
900▕ public static function upper($value)
901▕ {
➜ 902▕ return mb_strtoupper($value, 'UTF-8');
903▕ }
904▕
905▕ /**
906▕ * Convert the given string to title case.
+9 vendor frames
10 app/Http/Livewire/User/UpdateTimeplanForm.php:98
Livewire\Component::validate()
+31 vendor frames
42 tests/Feature/User/UpdateTimeplanForm.php:143
Livewire\Testing\TestableLivewire::call("update")
Add the attributes
array like in the discription to the validation.php
and run php artisan lang:update
@caouecs, hi!
I decided to push my repository to the organization. In the near future I will prepare changes to the package name and namespace.
I need your help now. I do not have access to the settings of this repository. Can you change the name of the project from laravel-lang-publisher
to publisher
?
@andrey-helldar In Laravel 9 it was detected if jetstream was installed and the translations were added, in Laravel 10 only the framework translations are added, that is, it is not working
There may also be bugs with breeze or other packages
laravel new project --jet
livewire
stack (also i choose phpunit
)config.app.locale
to es
composer require laravel-lang/publisher laravel-lang/lang laravel-lang/attributes --dev
php artisan lang:add es
Result
Spanish translations for Jetstream Views weren't added.
When I run php artisan lang:add de
, it also overwrites my en
files. Shouldn't it only add de
in this case?
php artisan lang:add de
en
files getting overwritten TypeError
LaravelLang\Publisher\Processors\Processor::LaravelLang\Publisher\Processors\{closure}(): Argument #1 ($plugin) must be of type string, array given, called in .../vendor/dragon-code/support/src/Instances/Call.php on line 163
at vendor/laravel-lang/publisher/src/Processors/Processor.php:123
119▕ {
120▕ return Arr::of($this->config->plugins())
121▕ ->map(static function (array $plugins): array {
122▕ return Arr::of($plugins)
➜ 123▕ ->map(static fn (string $plugin) => new $plugin())
124▕ ->filter(static fn (Plugin $plugin) => $plugin->has())
125▕ ->toArray();
126▕ })
127▕ ->filter()
If you create a new project and install a language, the 'validation-inline' translations are used instead of 'validation'. Also, the original lang\en\validation.php is changed in this way.
I would have expected that either 'validation' is used or that both are installed separately.
If this is expected default behaviour, how can I choose to use 'validation' instead? Or how can I have them both installed separately?
composer create-project laravel/laravel ./
composer require laravel-lang/publisher laravel-lang/lang --dev
php artisan lang:add en nl de
Upon trying to add a language, the following legend shows: "Could not find plugins available for processing". The same occurs when using lang:update(I had the assets from a previous version).
When run php artisan lang:update
all keys within attributes array removed for all locales but en.
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',
],
];
php artisan lang:add es
Hi,
First thanks for your package I use on several projects !
I'm facing an issue : keys from Notifications (in /vendor/laravel/framework/src/Illuminate/Auth/Notifications) are not included in json files while they are present in https://github.com/Laravel-Lang/lang
Do you have an idea why this happens ?
Thanks !
Publish files for french => Search for "Reset Password Notification" in fr.json => not present
I'm using Arabic locale. After upgrading to v11.1.6 from v10:
When run php artisan lang:update
the following keys deleted from the validation file (accepted_if, declined, declined_if, prohibits). Also, the attributes array became empty.
When adding any locale, e.g. fr, the package publishes the files with an empty array as content.
Considering the documentation (https://laravel-lang.github.io/publisher/features/alignment.html), I understand that if you disable alignment, then the comments should stay. Or why would that section even talk about comments being removed?
'alignment' => false,
in the config filejson translations for laravel/framework
are not published, only json translations of packages are published
Delete json translations files from resources/lang
and run php artisan lang:update
Question:
When I use the facade in my middleware to set request based locales, I am forced to pull all three packages in production i.s.o. dev in my composer.json.
Is this how it should be, or am I not using the facade as designed?
Hello,
I'm experiencing strange behavior with my forxer/generic-term-translations-for-laravel plugin for Laravel Lang
I have a file /source/misc.php in which there is an array key named "required"' Link
When I update the language files, I find /lang/{language}/misc.php with the good translation.
So far, so good
But when I call the translation {{ trans('misc.required') }}
this is replaced by that of the validation.php file.
I was expecting to get what's in the plugin's misc.php file but I got what's in the validation.php file instead.
Install forxer/generic-term-translations-for-laravel
Display in a view {{ trans('misc.required') }}
Expected string:
Result string:
Run the composer update
and updated the package to 11.2.1
version.
The following message appeared in the console:
Removing laravel-lang/lang
Starting with publisher version 11.2
, we switched to a new model, now this package is not tied to a specific project with translations, in addition, such changes reduce code duplication when testing the laravel-lang/lang
repository.
Starting from version 11.2
, you need to install the laravel-lang/lang
dependency in your application yourself:
composer require laravel-lang/publisher laravel-lang/lang --dev
We have updated the documentation section about this: https://laravel-lang.github.io/publisher/installation.html
PS: @Laravel-Lang/laravel-lang, those of you who use this publisher
will also be interesting🙂
In my opinion, it would be more correct to call the option "pretty" than "alignment".
How do you think?
Translation does not work after updating to the latest version and updating transtaions using php artisan lang:update
.
After updating transtations the validation.php
file looks like:
<?php
return [
'attributes' => [
'frontend.email' => 'E-mail',
'frontend.password' => 'Password',
//...
]
];
Originally posted by @icaliman in #289 (comment)
When updating files, transfer block contents to new ones.
Available for Laravel 5.5 and above.
It's quite common that there are same key inside different files.
Inside the json.josn#L444 has a key with password
, which will be written to auth.php
used for the label for password input box.
At the same time, in php.json#L82 also has a key named password
. It is used for showing error when password is incorrect.
When the locale was generated, the one in the php.json
is reserved (or it replaced the value which generated from json.json
). It causes to show wrong string at password input box.
php artisan lang:add {any language}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.