How to keep a variable in COOKIE or GET query string?

With honor to @Wyck’s link, I managed to add a language variable by adding an action hook to init and set the locale into cookie using PHP’s setcookie() function.

For details, visit: Setting custom cookies in WordPress

tech