Index: /plugins/ysfR3Plugin/branches/1.1/lib/i18n/ysfR3I18N.class.php =================================================================== --- /plugins/ysfR3Plugin/branches/1.1/lib/i18n/ysfR3I18N.class.php (revision 10350) +++ /plugins/ysfR3Plugin/branches/1.1/lib/i18n/ysfR3I18N.class.php (revision 12626) @@ -52,12 +52,14 @@ $this->setCulture($options['default_culture']); + // create xliff dictionary if does not exist $dictionary = $this->getMessageSource()->getSource('messages'); if(!is_readable($dictionary)) { - // create r3 xliff + // create dictionary dir if(!file_exists(dirname($dictionary))) { mkdir(dirname($dictionary), 0775, true); } + // create r3 xliff file_put_contents($dictionary, $this->getMessageSource()->getTemplate('messages', $options['allowed_cultures'])); @chmod($dictionary, 0775); Index: /plugins/ysfR3Plugin/branches/1.1/lib/i18n/sfMessageSource_R3.class.php =================================================================== --- /plugins/ysfR3Plugin/branches/1.1/lib/i18n/sfMessageSource_R3.class.php (revision 10350) +++ /plugins/ysfR3Plugin/branches/1.1/lib/i18n/sfMessageSource_R3.class.php (revision 12626) @@ -148,5 +148,5 @@ if(sfConfig::get('sf_debug', false) === true) { - $this->getR3()->importXliffDictionary($source, 1); // save new strings to r3 + // $this->getR3()->importXliffDictionary($source, true); // save new strings to r3 } Index: /plugins/ysfR3Plugin/branches/1.1/lib/task/i18n/ysfI18nTranslateTask.class.php =================================================================== --- /plugins/ysfR3Plugin/branches/1.1/lib/task/i18n/ysfI18nTranslateTask.class.php (revision 10350) +++ /plugins/ysfR3Plugin/branches/1.1/lib/task/i18n/ysfI18nTranslateTask.class.php (revision 12626) @@ -40,4 +40,6 @@ $this->addOptions(array( new sfCommandOption('environment', 'env', sfCommandOption::PARAMETER_OPTIONAL, 'The environment name', 'cli'), + new sfCommandOption('import-xliff', 'import', sfCommandOption::PARAMETER_OPTIONAL, 'Import xliff dictionary', false), + new sfCommandOption('export-xliff', 'export', sfCommandOption::PARAMETER_OPTIONAL, 'Export xliff dictionary', false), )); @@ -93,22 +95,26 @@ $cultures = is_null($arguments['culture']) ? $i18n->getMessageSource()->getAllowedCultures() : array($arguments['culture']); - $dictionary = $i18n->getMessageSource()->getSource('messages'); - if (is_readable($dictionary)) - { - $import = new ysfI18nImportXliffTask($this->dispatcher, $this->formatter); - $import->run(array(), array('--merge=true')); - } - else - { - $dir = dirname($dictionary); - if(!is_dir($dir)) - { - mkdir($dir, 0775, true); - } + // import xliff dictionary + if($options['import-xliff'] === true) + { + $dictionary = $i18n->getMessageSource()->getSource('messages'); + if (is_readable($dictionary)) + { + $import = new ysfI18nImportXliffTask($this->dispatcher, $this->formatter); + $import->run(array(), array('--merge=true')); + } + else + { + $dir = dirname($dictionary); + if(!is_dir($dir)) + { + mkdir($dir, 0775, true); + } - // create r3 xliff - file_put_contents($dictionary, $i18n->getMessageSource()->getTemplate('messages', $options['allowed_cultures'])); - chmod($dictionary, 0775); - } + // create r3 xliff + file_put_contents($dictionary, $i18n->getMessageSource()->getTemplate('messages', $options['allowed_cultures'])); + chmod($dictionary, 0775); + } + } // translate entire applicaiton @@ -140,12 +146,17 @@ } - $export = new ysfI18nExportXliffTask($this->dispatcher, $this->formatter); - $export->run(array(), array('--merge=true')); - - break; + // export xliff dictionary + if($options['export-xliff'] === true) + { + $export = new ysfI18nExportXliffTask($this->dispatcher, $this->formatter); + $export->run(array(), array('--merge=true')); + } } } } + /** + * Translates the path with R3. + */ public function translatePath(ysfR3I18N $i18n, $in, $culture, $markup) { Index: /plugins/ysfR3Plugin/branches/1.1/lib/config/ysfR3ApplicationConfiguration.class.php =================================================================== --- /plugins/ysfR3Plugin/branches/1.1/lib/config/ysfR3ApplicationConfiguration.class.php (revision 10350) +++ /plugins/ysfR3Plugin/branches/1.1/lib/config/ysfR3ApplicationConfiguration.class.php (revision 12626) @@ -200,5 +200,5 @@ * @return string */ - private function updatePathForI18nCache($path, $update_cache = true) + public function updatePathForI18nCache($path, $update_cache = true) { // check this is not a core file (so we should translate locally) @@ -216,5 +216,4 @@ { $is_readable = is_readable($path); - if($is_readable === false || ($is_readable === true && (filemtime($path) < filemtime($original)))) {