$lc = ""; // Initialize the language code variable // Check to see that the global language server variable isset() // If it is set, we cut the first two characters from that string if( isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ){ $lc = strtolower( substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) ); } // set it as a Couch variable global $CTX; $CTX->set( 'my_lang', $lc, 'global' );