0

I have completed translation for Vue. I have 2 languages, EN & MS. Default would be in EN. How do I route the web link to view in MS? For standard Laravel page, I will add ?lang=en or ?lang=ms at the end of the link. How about Vue? Do I need to declare anything in blade file?

Rhaman
  • 23
  • 1
  • 5
  • Create a locale switcher in the header nav. If you are working on a single page application in multi lang. Check this starter template which would be a perfect fit. Or check the code how it plays with translations so that you can get the basic idea.https://github.com/cretueusebiu/laravel-vue-spa –  Jun 12 '18 at 16:04

2 Answers2

0

get the lang parameter using window.location, then store that in the browser:

localStorage.setItem('lang', lang);

to retrieve it later use:

var lang = localStorage.getItem('lang');
Hussein
  • 1,143
  • 1
  • 9
  • 16
-1

I suggest you the vue-i18n lib for handling the multi language.

There is my older answer how can you use this lib.

LakiGeri
  • 2,046
  • 6
  • 30
  • 56