From 87cd036826b4f0de81ccfbb8be91ba58ff13742f Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Mon, 18 Mar 2013 09:54:30 -0400 Subject: [PATCH] Improvement function processmaker plugins-translation - file .po is read and created in the plugin. --- workflow/engine/classes/model/Language.php | 18 +++++++++--------- workflow/engine/classes/model/Translation.php | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/workflow/engine/classes/model/Language.php b/workflow/engine/classes/model/Language.php index 5619bf8d9..f6171b7df 100755 --- a/workflow/engine/classes/model/Language.php +++ b/workflow/engine/classes/model/Language.php @@ -537,20 +537,20 @@ class Language extends BaseLanguage } G::streamFile( $sPOFile, true ); } - function updateLanguagePlugin ($plugin, $idLanguage) + public function updateLanguagePlugin ($plugin, $idLanguage) { if (!file_exists(PATH_PLUGINS . $plugin)) { throw new Exception( 'The plugin ' . $plugin . ' not exist' ); die(); } - if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translation.php')) { - throw new Exception( 'Translation.php not exist in plugin ' . $plugin); + if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translations.php')) { + throw new Exception( 'Translations.php not exist in plugin ' . $plugin); } - if (!file_exists(PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $idLanguage . '.po')) { + if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $idLanguage . '.po')) { throw new Exception( 'The file ' . $plugin . '.' . $idLanguage . '.po not exists' ); die(); } - $languageFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $idLanguage . '.po' ;//PATH_LANGUAGECONT . $plugin . '.' . $idLanguage; + $languageFile = PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $idLanguage . '.po' ; try { G::LoadSystem( 'i18n_po' ); $POFile = new i18n_PO( $languageFile ); @@ -657,9 +657,9 @@ class Language extends BaseLanguage } } - function createLanguagePlugin ($plugin, $idLanguage) + public function createLanguagePlugin ($plugin, $idLanguage) { - if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translation.php')) { + if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translations.php')) { throw new Exception( 'Translation.php not exist in plugin ' . $plugin); } @@ -667,7 +667,7 @@ class Language extends BaseLanguage G::LoadClass( "system" ); //creating the .po file - $sPOFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $idLanguage . '.po'; + $sPOFile = PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $idLanguage . '.po'; $poFile = new i18n_PO( $sPOFile ); $poFile->buildInit(); @@ -693,7 +693,7 @@ class Language extends BaseLanguage $aLabels = array (); $aMsgids = array ('' => true ); - include PATH_PLUGINS . $plugin . PATH_SEP . 'translations'. PATH_SEP . 'translation.php'; + include PATH_PLUGINS . $plugin . PATH_SEP . 'translations'. PATH_SEP . 'translations.php'; foreach ($translations as $id => $translation) { $msgid = trim( $translation); diff --git a/workflow/engine/classes/model/Translation.php b/workflow/engine/classes/model/Translation.php index d11acb3bf..5462c357c 100755 --- a/workflow/engine/classes/model/Translation.php +++ b/workflow/engine/classes/model/Translation.php @@ -230,11 +230,11 @@ class Translation extends BaseTranslation */ public function generateFileTranslationPlugin ($plugin, $languageId = '') { - if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translation.php')) { + if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translations.php')) { return; } - if (!file_exists(PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $languageId . '.po')) { + if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $languageId . '.po')) { return; } $translation = Array (); @@ -243,7 +243,7 @@ class Translation extends BaseTranslation if ($languageId === '') { $languageId = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; } - include PATH_PLUGINS . $plugin . PATH_SEP . 'translations'. PATH_SEP . 'translation.php'; + include PATH_PLUGINS . $plugin . PATH_SEP . 'translations'. PATH_SEP . 'translations.php'; $cacheFile = PATH_LANGUAGECONT . $plugin . "." . $languageId; $cacheFileJS = PATH_CORE . 'js' . PATH_SEP . 'labels' . PATH_SEP . $languageId . ".js"; @@ -251,7 +251,7 @@ class Translation extends BaseTranslation foreach ($translations as $key => $row) { $translation[$key] = $row; } - $languageFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $languageId . '.po' ; + $languageFile = PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $languageId . '.po' ; G::LoadSystem( 'i18n_po' ); $POFile = new i18n_PO( $languageFile ); $POFile->readInit();