Changeset 270 for trunk/patTemplate
- Timestamp:
- 08/20/04 10:33:44 (4 years ago)
- Files:
-
- trunk/patTemplate/Function/Translate.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/patTemplate/Function/Translate.php
r258 r270 220 220 * get the 'gettext' source file 221 221 */ 222 $this->_sentences[$input] = @parse_ini_file( $this->_config[ 'sentenceFile'] );222 $this->_sentences[$input] = @parse_ini_file( $this->_config[$input]['sentenceFile'] ); 223 223 if( !is_array( $this->_sentences[$input] ) ) 224 224 $this->_sentences[$input] = array(); 225 else 226 $this->_sentences[$input] = array_map( array( $this, '_unescape' ), $this->_sentences[$input] ); 227 225 228 226 229 return true; … … 244 247 if( is_array( $tmp ) ) 245 248 { 249 $tmp = array_map( array( $this, '_unescape' ), $tmp ); 246 250 $this->_translation[$input] = $tmp; 247 251 return true; … … 250 254 return false; 251 255 } 256 257 /** 258 * unsecape the text that has been read from the translation file 259 * 260 * @access private 261 * @param string 262 * @return string 263 */ 264 function _unescape( $text ) 265 { 266 return str_replace( '"', '"', $text ); 267 } 252 268 253 269 /** … … 255 271 * 256 272 * @access private 257 258 273 * @param string unique key 259 274 * @param string sentence to translate … … 266 281 if( !$fp ) 267 282 return false; 268 fputs( $fp, sprintf( '%s = "%s"'."\n", $key, addslashes($content ) ) );283 fputs( $fp, sprintf( '%s = "%s"'."\n", $key, str_replace( '"', '"', $content ) ) ); 269 284 flock( $fp, LOCK_UN ); 270 285 fclose( $fp );
