Localization tips

JSON is a better way to do translations.

{
	"前往產品":"Go To Products",
	"筆|筆":"Record|Records",
	"":""
}
@lang('前往產品')
@choice('筆|筆', 1)

https://laravel.com/docs/5.6/localization#pluralization

Constructor of a controller will be executed before middleware and route, so to manipulate session in construct will not work.

    public function __construct(){
        //parent::__construct();

        $this->middleware(function ($request, $next) {
            $locale = $request->input('locale');
            if($locale != false){
                session()->put('locale', $locale);
                App()->setLocale($locale);
            }else if(session()->get('locale') != false){
                App()->setLocale(session()->get('locale'));
            }

            return $next($request);
        });
    }