Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
@@ -330,10 +330,10 @@ class workspaceTools
|
|||||||
$extension = array_pop($names);
|
$extension = array_pop($names);
|
||||||
$langid = array_pop($names);
|
$langid = array_pop($names);
|
||||||
CLI::logging("Updating database translations with $poName\n");
|
CLI::logging("Updating database translations with $poName\n");
|
||||||
Language::import($poFile, false, true);
|
Language::import($poFile, false, true, false);
|
||||||
if ($first) {
|
if ($first) {
|
||||||
CLI::logging("Updating XML form translations with $poName\n");
|
CLI::logging("Updating XML form translations with $poName\n");
|
||||||
Language::import($poFile, true, false);
|
Language::import($poFile, true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ class Language extends BaseLanguage
|
|||||||
* @param string $bXml
|
* @param string $bXml
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function import ($sLanguageFile, $updateXml = true, $updateDB = true)
|
public function import ($sLanguageFile, $updateXml = true, $updateDB = true, $generateMafe = true)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
G::LoadSystem( 'i18n_po' );
|
G::LoadSystem( 'i18n_po' );
|
||||||
@@ -288,6 +288,11 @@ class Language extends BaseLanguage
|
|||||||
$trn->addTranslationEnvironment( $LOCALE, $POHeaders, $countItemsSuccess );
|
$trn->addTranslationEnvironment( $LOCALE, $POHeaders, $countItemsSuccess );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($generateMafe) {
|
||||||
|
$trn = new Translation();
|
||||||
|
$trn->generateFileTranslationMafe();
|
||||||
|
}
|
||||||
|
|
||||||
//fill the results
|
//fill the results
|
||||||
$results = new stdClass();
|
$results = new stdClass();
|
||||||
$results->recordsCount = $countItems;
|
$results->recordsCount = $countItems;
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ class Translation extends BaseTranslation
|
|||||||
if (! is_dir( dirname( $cacheFileJS ) )) {
|
if (! is_dir( dirname( $cacheFileJS ) )) {
|
||||||
G::mk_dir( dirname( $cacheFileJS ) );
|
G::mk_dir( dirname( $cacheFileJS ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$f = fopen( $cacheFile, 'w+' );
|
$f = fopen( $cacheFile, 'w+' );
|
||||||
fwrite( $f, "<?php\n" );
|
fwrite( $f, "<?php\n" );
|
||||||
fwrite( $f, '$translation =' . 'unserialize(\'' . addcslashes( serialize( $translation ), '\\\'' ) . "');\n" );
|
fwrite( $f, '$translation =' . 'unserialize(\'' . addcslashes( serialize( $translation ), '\\\'' ) . "');\n" );
|
||||||
@@ -194,6 +195,55 @@ class Translation extends BaseTranslation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Load strings from a Database for labels MAFE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function generateFileTranslationMafe ()
|
||||||
|
{
|
||||||
|
$translation = Array ();
|
||||||
|
|
||||||
|
$c = new Criteria();
|
||||||
|
$c->add( TranslationPeer::TRN_ID, '%ID_MAFE_%', Criteria::LIKE );
|
||||||
|
$c->addAscendingOrderByColumn( 'TRN_CATEGORY' );
|
||||||
|
$c->addAscendingOrderByColumn( 'TRN_ID' );
|
||||||
|
$c->addAscendingOrderByColumn( 'TRN_LANG' );
|
||||||
|
$tranlations = TranslationPeer::doSelect( $c );
|
||||||
|
|
||||||
|
$mafeFolder = PATH_HTML . "translations";
|
||||||
|
$cacheFileMafe = PATH_HTML . "translations" . PATH_SEP. 'translationsMafe' . ".js";
|
||||||
|
|
||||||
|
foreach ($tranlations as $key => $row) {
|
||||||
|
if ($row->getTrnCategory() === 'LABEL') {
|
||||||
|
$translation[$row->getTrnLang()][$row->getTrnId()] = $row->getTrnValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (! is_dir( dirname( $mafeFolder ) )) {
|
||||||
|
G::mk_dir( dirname( $mafeFolder, 0777 ) );
|
||||||
|
}
|
||||||
|
if (! is_dir( dirname( $cacheFileMafe ) )) {
|
||||||
|
G::mk_dir( dirname( $cacheFileMafe, 0777 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$f = fopen( $cacheFileMafe, 'w+' );
|
||||||
|
if ($f == false) {
|
||||||
|
error_log("Error: Cannot write into cacheFileMafe: $cacheFileMafe\n");
|
||||||
|
} else {
|
||||||
|
fwrite( $f, "var __TRANSLATIONMAFE = " . Bootstrap::json_encode( $translation ) . ";\n");
|
||||||
|
fclose( $f );
|
||||||
|
}
|
||||||
|
|
||||||
|
$res['cacheFileMafe'] = $cacheFileMafe;
|
||||||
|
$res['languague'] = count($cacheFileMafe);
|
||||||
|
$res['rowsMafeJS'] = count( $translation );
|
||||||
|
return $res;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns an array with
|
* returns an array with
|
||||||
* codError 0 - no error, < 0 error
|
* codError 0 - no error, < 0 error
|
||||||
|
|||||||
@@ -63,8 +63,10 @@
|
|||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/lib/js/mafe-{$buildhash}.js"></script>
|
<script type="text/javascript" src="/lib/js/mafe-{$buildhash}.js"></script>
|
||||||
|
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
<!-- translations -->
|
||||||
|
<script type="text/javascript" src="/translations/translationsMafe.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body onresize="resizingFrame();">
|
<body onresize="resizingFrame();">
|
||||||
<section class="navBar">
|
<section class="navBar">
|
||||||
|
|||||||
Reference in New Issue
Block a user