title: Redirecting to the same page but switched language url, using Nuxt.js and Vue-i18n
body: <p>I am trying to redirect the user through a method when he clicks on specific buttons to change the language of the application. 
  <br>These buttons are part of the standard layout of which all the pages of the project are part of so the url can differ based on which <code>.vue</code> page the user is on but the buttons are always the same which means that the redirecting has to be dynamic.
  <br><br>For example the url :</p>
  
  <pre><code>localhost/about
  </code></pre>
  
  <p><br>Should be redirected through the method (by pressing the specific button) to :</p>
  
  <pre><code>localhost/bg/about
  </code></pre>
  
  <p><br>In the project the pages are inside a folder <code>_locale</code> and imported also from the .vue files outside of this folder as suggested in the Nuxt documentation for localization with Vue-i18n <a href="https://nuxtjs.org/examples/i18n/" rel="nofollow noreferrer">https://nuxtjs.org/examples/i18n/</a>
  <br> The same way are implemented the <code>nuxt.config.js</code> , <code>i18n.js</code> middleware, <code>i18n.js</code> plugin and <code>index.js</code> store files.</p>
  
  <p><br>Since it is a <code>Nuxt.js</code> application and not just a <code>Vue.js</code> one, just committing the mutation of the store through a page changing the <code>locale</code> (the language) doesn't also actually change the language and even if it did ( using <code>this.$i18n.locale = 'bg'</code> for example ) it only changes it for the specific page and with the next navigation it uses again the <code>fallback locale</code> instead, so I am trying to solve it with redirecting which does use then the correct <code>.json</code> file of the language based on the url. I am just trying to find a way for this redirecting to be more dynamic instead of nagigating only back to the <code>home</code> page of each language.</p>
  
  <p><br>If needed the github repo : <a href="https://github.com/alexgil1994/logistics-gls" rel="nofollow noreferrer">https://github.com/alexgil1994/logistics-gls</a></p>
  
  <p><br>Steps needed :</p>
  
  <pre><code>npm install
  npm run dev
  </code></pre>
  
  <p><br>Could it be done in some better way? Is there any example of Regex for such a situation? Is there an easier way than Regex?
  <br>All suggestions are welcome.</p>