Show
Ignore:
Timestamp:
06/30/2008 12:04:42 PM (5 months ago)
Author:
mikl
Message:

Implemented MessageSource?_Database

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/framework/I18N/core/MessageSource.php

    r1398 r2470  
    109109        /** 
    110110         * Factory method to instantiate a new MessageSource depending on the 
    111          * source type. The allowed source types are 'XLIFF', 'SQLite',  
    112          * 'MySQL', and 'gettext'. The source parameter is dependent on the  
    113          * source type. For 'gettext' and 'XLIFF', it should point to the directory 
    114          * where the messages are stored. For database types, e.g. 'SQLite' and  
    115          * 'MySQL', it should be a PEAR DB style DSN string.  
     111         * source type. The allowed source types are 'XLIFF', 'gettext' and 
     112     * 'Database'. The source parameter depends on the source type.  
     113     * For 'gettext' and 'XLIFF', 'source' should point to the directory  
     114     * where the messages are stored.  
     115     * For 'Database', 'source' should be a valid connection id. 
     116     * If (deprecated) 'MySQL' is used, 'source' must contain a valid  
     117     * DSN. 
    116118         * 
    117119         * Custom message source are possible by supplying the a filename parameter 
     
    119121         *  
    120122         * @param string the message source type. 
    121          * @param string the location of the resource. 
     123         * @param string the location of the resource or the ConnectionID. 
    122124         * @param string the filename of the custom message source. 
    123125         * @return MessageSource a new message source of the specified type.  
     
    126128        static function &factory($type, $source='.', $filename='') 
    127129        { 
    128                 $types = array('XLIFF', 'SQLite', 'MySQL', 'gettext'); 
    129                  
    130                 if(empty($filename) && in_array($type, $types) == false) 
     130                $types = array('XLIFF', 'MySQL', 'Database', 'gettext'); 
     131                 
     132                if(empty($filename) && !in_array($type, $types)) 
    131133                        throw new Exception('Invalid type "'.$type.'", valid types are '. 
    132134                                implode(', ', $types));