Laravel-Lang / lang

List of 126 languages for Laravel Framework, Laravel Jetstream, Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova, Laravel Spark and Laravel UI.

Home Page:https://laravel-lang.com/packages-lang.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal: validation-strings without attribute placeholder

kohlerdominik opened this issue · comments

Hi

Issue

By default Laravel always uses the :attributes-Placeholder in it's validation strings.
But for example in in Material Design it's recommendet to provide the Error Message right next to the Input field (Source). This kind of makes the :attribute a redundancy. While for english, the guessed names may be usuable mostly (not always pretty, but at least usable), for other languages you're basically forced to translate every attribute as well.

For me, it's is especially cumbersome if you have devided front- and backend. You need to maintain the attribute name once in the Frontend Label-tag, and once in the Backend, while there's basically no benefit in it.


Example how this currently looks like (rule:numeric)
grafik

Example from the same in german or french
grafik
Note how the label is translated, but the :attribute would require an extra translation in this case.


Proposed Solution

Within this package, we could start a second series of translations with more generic text, which do not use the :attribute-tag in the translated string. So in above examples, it would mean using something like

This has to be a number.
Das muss eine Zahl sein.
Il doit s'agir d'un numéro [translation from DeepL]

I would be happy to help with this. However, the benefit should be reasonable to others, too, so we can quickly start with a couple of languages like English (by me), German (by me), French, Spanish?

It's a very good idea, we can do another branch with it

Can you do a pull request with english and german translations ? I can do for French

Hi @caouecs

Thanks for the positive Feedback. I just didn't find time yet, but I'll create the PR next week.