traduction de pages avec data_module

This commit is contained in:
deltacms 2024-04-02 11:07:46 +02:00
parent d99d8536bd
commit 608dbe1e50
1 changed files with 10 additions and 0 deletions

View File

@ -96,6 +96,7 @@ class translate extends common {
$success = (copy (self::DATA_DIR . $copyFrom . '/page.json', self::DATA_DIR . $toCreate . '/page.json') === true && $success === true) ? true : false;
$success = ($this->copyDir (self::DATA_DIR . $copyFrom . '/content', self::DATA_DIR . $toCreate . '/content') === true && $success === true) ? true : false;
$success = (copy ('core/module/translate/ressource/comment.json', self::DATA_DIR . $toCreate . '/comment.json') === true && $success === true) ? true : false;
$success = ($this->copyDir (self::DATA_DIR . $copyFrom . '/data_module', self::DATA_DIR . $toCreate . '/data_module') === true && $success === true) ? true : false;
// Enregistrer la langue
if ($success) {
$this->setData(['config', 'i18n', $toCreate, 'site' ]);
@ -146,6 +147,15 @@ class translate extends common {
}
// Ajout des données dans content
$success = (copy (self::DATA_DIR . $copyFrom . '/content/'.$pageId.'.html', self::DATA_DIR . $toCreate . '/content/'.$pageId.'.html') === true && $success === true) ? true : false;
// Ajout des données, externes à module.json, contenues dans data_module/nom_de_la_page.json
if( is_file( self::DATA_DIR . $copyFrom . '/data_module/'.$pageId.'.json' ) ) copy (self::DATA_DIR . $copyFrom . '/data_module/'.$pageId.'.json' , self::DATA_DIR . $toCreate . '/data_module/'.$pageId.'.json' );
// Cas particuliers d'une page agenda
if( $this->getData(['page', $pageId, 'moduleId']) === 'agenda'){
if(is_dir( self::DATA_DIR . $copyFrom . '/data_module/'.$pageId )) $this->copyDir(self::DATA_DIR . $copyFrom . '/data_module/'.$pageId, self::DATA_DIR . $toCreate . '/data_module/'.$pageId );
if(is_dir( self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_sauve' )) $this->copyDir(self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_sauve', self::DATA_DIR . $toCreate . '/data_module/'.$pageId .'_sauve' );
if(is_dir( self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_affiche')) $this->copyDir(self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_affiche', self::DATA_DIR . $toCreate . '/data_module/'.$pageId .'_affiche');
if(is_dir( self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_visible')) $this->copyDir(self::DATA_DIR . $copyFrom . '/data_module/'.$pageId .'_visible', self::DATA_DIR . $toCreate . '/data_module/'.$pageId .'_visible');
}
// Notification du titre court de la page copiée
$notification = $this->getData(['page',$pageId,'shortTitle']).$text['core_translate']['copy'][7]. $langTarget;
}