title: How to translate user inputs in laravel
body: <p>I have a website that is developed with Laravel which supports multi languages using localization.</p>
  <p>firstly: I created the language folder along with its file
  /resources/lang/en/message.php</p>
  <pre><code>&lt;?php
  
  return [
      'page_title' =&gt; 'Welcome Page',
      'welcome_message' =&gt; 'Hi, Welcome to this page',
      'author_information' =&gt; 'My name is Sanjay. This blog is mine and we created this post for you to learn.',
  ];
  </code></pre>
  <p>/resources/lang/fr/messages.php</p>
  <pre><code>&lt;?php
  
  return [
      'page_title' =&gt; 'Pagina de bienvenida',
      'welcome_message' =&gt; 'Hola bienvenido a esta pagina',
      'author_information' =&gt; 'Mi nombre es Sanjay. Este blog es mío y creamos esta publicación para que aprendas.',
  ];
  </code></pre>
  <p>secondly: I created the application routes in web.php file</p>
  <pre><code>Route::get('/', [LocalizationController::class, &quot;index&quot;]);
  Route::get('change/lang', [LocalizationController::class, &quot;lang_change&quot;])-&gt;name('LangChange');
  </code></pre>
  <p>thirdly: I created the LocalizationController to mange the language changes</p>
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  use Illuminate\Http\Request;
  use Illuminate\Support\Facades\App;
  
  class LocalizationController extends Controller
  {
      public function index()
      {
          return view('language');
      }
      public function lang_change(Request $request)
      {
          App::setLocale($request-&gt;lang);
          session()-&gt;put('locale', $request-&gt;lang);
          return view('language');
      }
  }
  </code></pre>
  <p>lastly: The language can be changed using the drop down list which is managed by the LocalizationController</p>
  <pre><code>&lt;body&gt;
      &lt;div class=&quot;container&quot;&gt;
          &lt;div class=&quot;row&quot; style=&quot;text-align: center;margin-top: 40px;&quot;&gt;
              &lt;h2&gt;How to Create Multi Language Website in Laravel - Online Web Tutor Blog&lt;/h2&gt;&lt;br&gt;
              &lt;div class=&quot;col-md-2 col-md-offset-3 text-right&quot;&gt;
                  &lt;strong&gt;Select Language: &lt;/strong&gt;
              &lt;/div&gt;
              &lt;div class=&quot;col-md-4&quot;&gt;
                  &lt;select class=&quot;form-control Langchange&quot;&gt;
                      &lt;option value=&quot;en&quot; {{ session()-&gt;get('locale') == 'en' ? 'selected' : '' }}&gt;English&lt;/option&gt;
                      &lt;option value=&quot;es&quot; {{ session()-&gt;get('locale') == 'es' ? 'selected' : '' }}&gt;Spanish&lt;/option&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;h1 style=&quot;margin-top: 80px;&quot;&gt;{{ __('message.page_title') }}&lt;/h1&gt;
              &lt;h2 style=&quot;margin-top: 80px;&quot;&gt;{{ __('message.welcome_message') }}&lt;/h2&gt;
              &lt;h3 style=&quot;margin-top: 80px;&quot;&gt;{{ __('message.author_information') }}&lt;/h3&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;script type=&quot;text/javascript&quot;&gt;
      var url = &quot;{{ route('LangChange') }}&quot;;
      $(&quot;.Langchange&quot;).change(function(){
          window.location.href = url + &quot;?lang=&quot;+ $(this).val();
      });
  &lt;/script&gt;
  </code></pre>
  <p>However, when the user inserts data into the database using the website forms, the website shows exactly what user inserted, is there any way for the website to translate user inputs ?</p>