- }
-
- function isconnected() {
- return true;
- }
-
- /**
- * Convert to zh-tw
- *
- * @access private
- */
- function zh2tw($text) {
- return strtr($text, $this->zh2TW);
- }
-
- /**
- * Convert to zh-cn
- *
- * @access private
- */
- function zh2cn($text) {
- return strtr($text, $this->zh2CN);
- }
-
- /**
- * Convert to zh-sg
- *
- * @access private
- */
- function zh2sg($text) {
- return strtr(strtr($text, $this->zh2CN), $this->zh2SG);
- }
-
- /**
- * Convert to zh-hk
- *
- * @access private
- */
- function zh2hk($text) {
- return strtr(strtr($text, $this->zh2TW), $this->zh2HK);
- }
-
- /**
- * Convert the input to a different language variant
- *
- * @param string $text input text
- * @param string $tolang language variant
- * @return string the converted text
- * @access public
- */
- function convert($text, $tolang) {
- $t = '';
- switch($tolang) {
- case 'zh-cn':
- $t = $this->zh2cn($text);
- break;
- case 'zh-tw':
- $t = $this->zh2tw($text);
- break;
- case 'zh-sg':
- $t = $this->zh2sg($text);
- break;
- case 'zh-hk':
- $t = $this->zh2hk($text);
- break;
- default:
- $t = $text;
+ list( $infoline, $data ) = explode( '|', $result, 2 );
+ $info = explode( ';', $infoline );
+ $ret = array();
+ $i = 0;
+ foreach( $info as $variant ) {
+ list( $code, $len ) = explode( ' ', $variant );
+ $ret[strtolower( $code )] = substr( $data, $i, $len );
+ $i += $len;