I'm working on adding a language variable (locale) in my custom WordPress theme. I made the translation working by adding `?l=en_US` to the URL. I would like to add the parameter into COOKIE, such that the site will remember the choice.

Also, I would like to build a language switcher ( allow visitors to choose their own language ). How should I achieve it ?

I am able to get the locale by (and load the text domain):

    add_action('after_setup_theme', 'DYtheme_setup');
    add_filter('locale', 'DYtheme_localized');
    function DYtheme_setup(){
        load_theme_textdomain('donnie2012', get_template_directory() . '/lang');
    }
    function DYtheme_localized($locale) {
    	if (isset($_GET['l'])) {
    		return $_GET['l'];
    	}
    	return $locale;
    }

but how to make the language parameter into COOKIE & also in URL ? I've looked into `add_query_args` but I'm not sure I'm in right track.