public static function parse( $lang ) 
	{
		$conf = ClanCats::$config->language;
		
		if ( isset( $lang ) && strlen( $lang ) > 1 ) 
		{
			$lang = explode( ',', strtolower( $lang ) );
			$lang = explode( '-', $lang[0] );
			
			if ( !isset( $lang[1] ) ) 
			{
				$lang[1] = $lang[0];
			}
			
			$available = $conf['available'];
			
			if ( array_key_exists( $lang[0], $available ) ) 
			{
				// does even the region match?
				if ( in_array( $lang[1], $available[$lang[0]] ) ) 
				{
					return $lang[0].'-'.$lang[1];
				}
				// return the first region
				else 
				{
					$locales = $available[$lang[0]];
					return $lang[0].'-'.$locales[key($locales)];
				}
			}
		}
		
		// Return the default language when nothing coul be matched
		return $conf['default'];
	}