Replies: 1 comment
-
If anyone ever stumbles here, then one possible solution might be to just use the custom message as it is documented here. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
10.48.12
PHP Version
8.3.3
Database Driver & Version
No response
Description
I see a partial translation when using a validation rule required_if
Steps To Reproduce
I use Laravel tcg Voyager with this validation rule for "unité" field :
When i add datas, the message displayed is
Le champ utilisateurs est obligatoire quand la valeur de Unité responsable est empty.
2 problems :
Do you think it's Laravel problem or tcg Voyager problems ?
For the first problem, in vendor\laravel\framework\src\Illuminate\Validation\Concerns\ReplacesAttributes.php, i add $this->translator->get()
For vendor\laravel\framework\src\Illuminate\Translation\Translator.php, i dump $this->loaded
I see that in $this->loaded['* '], there is two value "*" and "validation" :
For vendor\laravel\framework\src\Illuminate\Translation\Translator.php, when i change
$line = $this->loaded['*']['*'][$locale][$key] ?? null;
by
$line = $this->loaded['*']['validation'][$locale][$key] ?? null;
empty is well translated, the message is
Le champ utilisateurs est obligatoire quand la valeur de Unité responsable est vide.
So, Laravel problem or tcg Voyager problems ?
Beta Was this translation helpful? Give feedback.
All reactions