title: sent laravel ( app()->getLocale() ) with url from JavaScript
body: <p>I've added other languages ​​to the site I'm working on .</p>
  
  <p>I make the the medalware :</p>
  
  <pre><code>    class SetLocale {
           public function handle($request, Closure $next)
                  {
                     App()-&gt;setLocale($request-&gt;segment(1));
                     return $next($request);
                  }
                }
  </code></pre>
  
  <p>the route :</p>
  
  <pre><code>  Route::group(
    ['prefix' =&gt; '{locale}', 
    'where' =&gt; ['locale' =&gt; 'en|fr|ar'],
    'middleware' =&gt; 'setlocale'],function ()
          {
             Route::get('mapData','HomPageController@mapData')-&gt;name('mapData');
          });
  </code></pre>
  
  <p>and everything works perfectly , but : I have a map from <a href="https://www.amcharts.com/" rel="nofollow noreferrer">https://www.amcharts.com/</a> that stop working because I didn't figure out how to pass the</p>
  
  <pre><code>    app()-&gt;getLocale()
  </code></pre>
  
  <p>in side the cod of map that is in JavaScript language</p>
  
  <pre><code>      polygonSeries.dataSource.url = "mapData";  
  </code></pre>
  
  <p>So how can I pass the    <strong>$langLocale</strong> in dataSource.url to be like this</p>
  
  <pre><code>polygonSeries.dataSource.url = "mapData",  app()-&gt;getLocale();
  </code></pre>
  
  <p>I made a way to make it work but this way it's static not dynamic this is what I did :</p>
  
  <pre><code>       polygonSeries.dataSource.url = "/en/mapData";
  </code></pre>
  
  <p>so is there any way to figure out what is the the language that comes from this code <strong>app()->getLocale();</strong> and send it as parameter form JavaScript file</p>