Prado\I18N\TGlobalization::setTranslationConfiguration PHP Method

setTranslationConfiguration() protected method

Sets the translation configuration. Example configuration: $config['type'] = 'XLIFF'; //XLIFF, gettext, Database or MySQL (deprecated) $config['source'] = 'Path.to.directory'; // for types XLIFF and gettext $config['source'] = 'connectionId'; // for type Database $config['source'] = 'mysql://user:pw@host/db'; // for type MySQL (deprecated) $config['catalogue'] = 'messages'; //default catalog $config['autosave'] = 'true'; //save untranslated message $config['cache'] = 'true'; //cache translated message $config['marker'] = '@@'; // surround untranslated text with '@@' Throws exception is source is not found.
protected setTranslationConfiguration ( $config )
    protected function setTranslationConfiguration($config)
    {
        if ($config['type'] == 'XLIFF' || $config['type'] == 'gettext') {
            if ($config['source']) {
                $config['source'] = Prado::getPathOfNamespace($config['source']);
                if (!is_dir($config['source'])) {
                    if (@mkdir($config['source']) === false) {
                        throw new TConfigurationException('globalization_source_path_failed', $config['source']);
                    }
                    chmod($config['source'], PRADO_CHMOD);
                    //make it deletable
                }
            } else {
                throw new TConfigurationException("invalid source dir '{$config['source']}'");
            }
        }
        if (isset($config['cache']) && TPropertyValue::ensureBoolean($config['cache'])) {
            $config['cache'] = $this->getApplication()->getRunTimePath() . '/i18n';
            if (!is_dir($config['cache'])) {
                if (@mkdir($config['cache']) === false) {
                    throw new TConfigurationException('globalization_cache_path_failed', $config['cache']);
                }
                chmod($config['cache'], PRADO_CHMOD);
                //make it deletable
            }
        } else {
            unset($config['cache']);
        }
        $this->_translation = $config;
    }