Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function get_langname_byBrowser()
- {
- $this->CI = & get_instance();
- // inicializamos, por si no detecta ninguna el navegador
- $name = "";
- //prepare user language array
- $languages = array();
- $languages[0] = '';
- //check to see if language is set
- if ( isset( $_SERVER["HTTP_ACCEPT_LANGUAGE"] ) )
- {
- //explode languages into array
- $languages = strtolower( $_SERVER["HTTP_ACCEPT_LANGUAGE"] );
- $languages = explode( ",", $languages );
- }
- $pos = strpos(strtolower($languages[0]),'es');
- if ( $pos !== false )
- $name = "spanish";
- else
- $name = "english";
- return $name;
- }
Add Comment
Please, Sign In to add comment