Improvement function processmaker plugins-translation
- file .po is read and created in the plugin.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user