本文整理汇总了PHP中Translation::generateFileTranslationMafe方法的典型用法代码示例。如果您正苦于以下问题:PHP Translation::generateFileTranslationMafe方法的具体用法?PHP Translation::generateFileTranslationMafe怎么用?PHP Translation::generateFileTranslationMafe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translation
的用法示例。
在下文中一共展示了Translation::generateFileTranslationMafe方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
//.........这里部分代码省略.........
//define locale
$LOCALE = "{$languageID}-{$countryID}";
} else {
$LOCALE = $languageID;
}
$oTranslation = new Translation();
$countItems = 0;
$countItemsSuccess = 0;
$errorMsg = '';
while ($rowTranslation = $POFile->getTranslation()) {
$countItems++;
if (!isset($POFile->translatorComments[0]) || !isset($POFile->translatorComments[1]) || !isset($POFile->references[0])) {
throw new Exception('The .po file doesn\'t have valid directives for Processmaker!');
}
foreach ($POFile->translatorComments as $a => $aux) {
$aux = trim($aux);
if ($aux == 'TRANSLATION') {
$identifier = $aux;
} else {
$var = explode('/', $aux);
if ($var[0] == 'LABEL') {
$context = $aux;
}
if ($var[0] == 'JAVASCRIPT') {
$context = $aux;
}
}
if (preg_match('/^([\\w-]+)\\/([\\w-]+\\/*[\\w-]*\\.xml\\?)/', $aux, $match)) {
$identifier = $aux;
} else {
if (preg_match('/^([\\w-]+)\\/([\\w-]+\\/*[\\w-]*\\.xml$)/', $aux, $match)) {
$context = $aux;
}
}
}
$reference = $POFile->references[0];
// it is a Sql insert on TRANSLATIONS TAble
if ($identifier == 'TRANSLATION') {
if ($updateDB) {
list($category, $id) = explode('/', $context);
$result = $oTranslation->addTranslation($category, $id, $LOCALE, trim(stripcslashes(str_replace(chr(10), '', $rowTranslation['msgstr']))));
if ($result['codError'] == 0) {
$countItemsSuccess++;
} else {
$errorMsg .= $id . ': ' . $result['message'] . "\n";
}
}
} elseif ($updateXml) {
$xmlForm = $context;
//erik: expresion to prevent and hable correctly dropdown values like -1, -2 etc.
preg_match('/^([\\w_]+)\\s-\\s([\\w_]+)\\s*-*\\s*([\\w\\W]*)$/', $reference, $match);
if (!file_exists(PATH_XMLFORM . $xmlForm)) {
$errorMsg .= 'file doesn\'t exist: ' . PATH_XMLFORM . $xmlForm . "\n";
continue;
}
if (count($match) < 4) {
$near = isset($rowTranslation['msgid']) ? $rowTranslation['msgid'] : (isset($rowTranslation['msgstr']) ? $rowTranslation['msgstr'] : '');
$errorMsg .= "Invalid Translation reference: \"{$reference}\", near -> " . strip_tags($near) . "\n";
continue;
}
G::LoadSystem('dynaformhandler');
$dynaform = new dynaFormHandler(PATH_XMLFORM . $xmlForm);
$fieldName = $match[2];
$codes = explode('-', $reference);
if (sizeof($codes) == 2) {
//is a normal node
$dynaform->addChilds($fieldName, array($LOCALE => stripcslashes(str_replace(chr(10), '', $rowTranslation['msgstr']))));
} elseif (sizeof($codes) > 2) {
//is a node child for a language node
$name = $match[3] == "''" ? '' : $match[3];
$childNode = array(array('name' => 'option', 'value' => $rowTranslation['msgstr'], 'attributes' => array('name' => $name)));
$dynaform->addChilds($fieldName, array($LOCALE => null), $childNode);
}
$countItemsSuccess++;
}
}
$oLanguage = new Language();
$oLanguage->update(array('LAN_ID' => $languageID, 'LAN_ENABLED' => '1'));
if ($updateXml) {
$trn = new Translation();
$trn->generateFileTranslation($LOCALE);
$trn->addTranslationEnvironment($LOCALE, $POHeaders, $countItemsSuccess);
}
if ($generateMafe) {
$trn = new Translation();
$trn->generateFileTranslationMafe();
}
//fill the results
$results = new stdClass();
$results->recordsCount = $countItems;
$results->recordsCountSuccess = $countItemsSuccess;
$results->lang = $languageID;
$results->headers = $POHeaders;
$results->errMsg = $errorMsg;
G::auditLog("UploadLanguage", "Language: " . $languageID);
return $results;
} catch (Exception $oError) {
throw $oError;
}
}
示例2: index
//.........这里部分代码省略.........
$this->setVar('isDebugMode', $debug);
$this->setVar("distribution", $distribution);
if ($debug) {
if (! file_exists(PATH_HTML . "lib-dev/pmUI/build.cache")) {
throw new RuntimeException("Development JS Files were are not generated!.\nPlease execute: \$>rake pmBuildDebug in pmUI project");
}
if (! file_exists(PATH_HTML . "lib-dev/mafe/build.cache")) {
throw new RuntimeException("Development JS Files were are not generated!.\nPlease execute: \$>rake pmBuildDebug in MichelangeloFE project");
}
$mafeFiles = file(PATH_HTML . "lib-dev/mafe/build.cache", FILE_IGNORE_NEW_LINES);
$mafeCssFiles = array();
$mafeJsFiles = array();
foreach ($mafeFiles as $file) {
if (substr($file, -3) == ".js") {
$mafeJsFiles[] = $file;
} else {
$mafeCssFiles[] = $file;
}
}
$this->setVar('pmuiJsCacheFile', file(PATH_HTML . "lib-dev/pmUI/build.cache", FILE_IGNORE_NEW_LINES));
$this->setVar('pmuiCssCacheFile', file(PATH_HTML . "lib-dev/pmUI/css.cache", FILE_IGNORE_NEW_LINES));
$this->setVar('designerCacheFile', file(PATH_HTML . "lib-dev/mafe/applications.cache", FILE_IGNORE_NEW_LINES));
$this->setVar('mafeJsFiles', $mafeJsFiles);
$this->setVar('mafeCssFiles', $mafeCssFiles);
} else {
$buildhashFile = PATH_HTML . "lib/buildhash";
if (! file_exists($buildhashFile)) {
throw new RuntimeException("CSS and JS Files were are not generated!.\nPlease review install process");
}
$buildhash = file_get_contents($buildhashFile);
$this->setVar('buildhash', $buildhash);
}
$translationMafe = "/translations/translationsMafe.js";
$this->setVar('translationMafe', $translationMafe);
if (!file_exists(PATH_HTML . "translations" . PATH_SEP. 'translationsMafe' . ".js")) {
$translation = new Translation();
$translation->generateFileTranslationMafe();
}
$this->setVar('sys_skin', SYS_SKIN);
$this->setView('designer/index');
$this->render();
}