Replacing parameters dynamically in language lines in Laravel 5.1 #10879
Replies: 6 comments 1 reply
-
Hi @essivision I need exactly you asked in your post. Did you find a solution for it? Thank you. |
Beta Was this translation helpful? Give feedback.
-
just change like this ['name' => $name]; |
Beta Was this translation helpful? Give feedback.
-
Hi @masterpieceicang Thank you for your answer but that doesn't work. controller.php
validation.php (validation language lines)
Expected result: I want the :attribute parameter dynamically change with the attribute I have set for all the languages |
Beta Was this translation helpful? Give feedback.
-
I have the same problem, any solution? |
Beta Was this translation helpful? Give feedback.
-
trans('messages.welcome', ['name' => $name]); 'welcome' => 'Wassssup :name!', |
Beta Was this translation helpful? Give feedback.
-
Use __() helper function instead of trans() |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have language file called
resources/lang/en/message.php
in laravel 5.1. Now I want to define a custom message line like this:and use in page.blade.php with following format:
In Laravel Documentation said to replace parameter it should be written:
But I want the
:name
parameter dynamically load in all language and I don't type statically.In Laravel has avalidation.php
that has a attributes array to get variable of attribute. I like to do. I think we can do so againBeta Was this translation helpful? Give feedback.
All reactions