当前位置: 首页>>代码示例>>PHP>>正文


PHP Translation::generateFileTranslation方法代码示例

本文整理汇总了PHP中Translation::generateFileTranslation方法的典型用法代码示例。如果您正苦于以下问题:PHP Translation::generateFileTranslation方法的具体用法?PHP Translation::generateFileTranslation怎么用?PHP Translation::generateFileTranslation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Translation的用法示例。


在下文中一共展示了Translation::generateFileTranslation方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ini_set

Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
// Session Initializations
ini_set('session.auto_start', '1');
// The register_globals feature has been DEPRECATED as of PHP 5.3.0. default value Off.
// ini_set( 'register_globals', 'Off' );
//session_start();
ob_start();
// Rebuild the base Workflow translations if not exists
if (!is_file(PATH_LANGUAGECONT . 'translation.en')) {
    require_once "classes/model/Translation.php";
    $fields = Translation::generateFileTranslation('en');
}
// TODO: Verify if the language set into url is defined in translations env.
if (SYS_LANG != 'en' && !is_file(PATH_LANGUAGECONT . 'translation.' . SYS_LANG)) {
    require_once "classes/model/Translation.php";
    $fields = Translation::generateFileTranslation(SYS_LANG);
}
// Setup plugins
$oPluginRegistry->setupPlugins();
//get and setup enabled plugins
$avoidChangedWorkspaceValidation = false;
// Load custom Classes and Model from Plugins.
G::LoadAllPluginModelClasses();
// jump to php file in methods directory
$collectionPlugin = '';
if ($oPluginRegistry->isRegisteredFolder(SYS_COLLECTION)) {
    $phpFile = PATH_PLUGINS . SYS_COLLECTION . PATH_SEP . SYS_TARGET . '.php';
    $targetPlugin = explode('/', SYS_TARGET);
    $collectionPlugin = $targetPlugin[0];
    $avoidChangedWorkspaceValidation = true;
} else {
开发者ID:rodriquelca,项目名称:processmaker,代码行数:31,代码来源:sysGeneric.php

示例2: Translation

 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
require_once "classes/model/Translation.php";
$t = new Translation();
$fields = Translation::generateFileTranslation('en');
$G_MAIN_MENU = 'tools';
$G_SUB_MENU = 'toolsTranslations';
$G_ID_MENU_SELECTED = 'TRANSLATION';
$G_ID_SUB_MENU_SELECTED = 'TRANSLATION_REBUILD';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'tools/updateTranslation', '', $fields);
if (isset($_SESSION['TOOLS_VIEWTYPE']) && $_SESSION['TOOLS_VIEWTYPE'] == 'blank') {
    G::RenderPage('publishBlank', 'green-submenu');
} else {
    G::RenderPage('publish');
}
开发者ID:emildev35,项目名称:processmaker,代码行数:31,代码来源:updateTranslation.php

示例3: 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;
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:101,代码来源:Language.php

示例4: rebuild

 public function rebuild()
 {
     try {
         $t = new Translation();
         $result = Translation::generateFileTranslation('en');
         $result['success'] = true;
     } catch (Exception $e) {
         $result->success = false;
         $result->msg = $e->getMessage();
     }
     print G::json_encode($result);
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:12,代码来源:ajaxListener.php

示例5: rebuild

 function rebuild()
 {
     try {
         require_once "classes/model/Translation.php";
         $t = new Translation();
         $result = Translation::generateFileTranslation('en');
         $result['success'] = true;
     } catch (Exception $e) {
         $result->success = false;
         $result->msg = $e->getMessage();
     }
     print G::json_encode($result);
 }
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:13,代码来源:ajaxListener.php

示例6: Translation

    $pathFile = $filter->validateInput(PATH_CLASSES . "model" . PATH_SEP . "Translation.php", "path");

    require_once ($pathFile);

    $pmTranslation = new Translation();
    $fields = $pmTranslation->generateFileTranslation("en");
}

// TODO: Verify if the language set into url is defined in translations env.
if (SYS_LANG != 'en' && ! is_file( PATH_LANGUAGECONT . 'translation.' . SYS_LANG )) {
    $pathFile = $filter->validateInput(PATH_CLASSES . "model" . PATH_SEP . "Translation.php", "path");

    require_once ($pathFile);

    $pmTranslation = new Translation();
    $fields = $pmTranslation->generateFileTranslation(SYS_LANG);
}

// Setup plugins
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$avoidChangedWorkspaceValidation = false;

// Load custom Classes and Model from Plugins.
Bootstrap::LoadAllPluginModelClasses();

// jump to php file in methods directory
$collectionPlugin = '';
if ($oPluginRegistry->isRegisteredFolder( SYS_COLLECTION )) {
    $phpFile = PATH_PLUGINS . SYS_COLLECTION . PATH_SEP . SYS_TARGET . '.php';
    $targetPlugin = explode( '/', SYS_TARGET );
    $collectionPlugin = $targetPlugin[0];
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:31,代码来源:sysGeneric.php

示例7: htmlspecialchars

                 return;
             }
             if ($query->count() > 1) {
                 echo "The {$cat}:{$node}:{$lang} in table '{$table}' is not unique";
                 return;
             }
             $res = $query->read();
             echo htmlspecialchars($res['TRN_VALUE']);
             break;
             break;
     }
     G::LoadClass("translation");
     $dbc = new DBConnection();
     $obj = new Translation();
     $obj->SetTo($dbc);
     $translation2 = $obj->generateFileTranslation();
     break;
 case "listLanguage":
     $query = $ses->execute("select distinct TRN_LANG from {$table}", false);
     $template = new TemplatePower(PATH_CORE . 'templates/tools/translationsTP.html');
     $template->prepare();
     $template->newBlock("languageList");
     $template->assign("ajaxDelLang", ajax_event("onclick", "translationsAjax", "showSpace", "'function=delLanguage&lang='+encodeURI(getElementById('language').value)", 'hideLangBar'));
     for ($r = 1; $r <= $query->count(); $r++) {
         $res = $query->read();
         $template->newBlock("languageItem");
         $template->assign("langIdRadio", $res['TRN_LANG']);
     }
     $template->printToScreen();
     break;
 case "show":
开发者ID:emildev35,项目名称:processmaker,代码行数:31,代码来源:translationsAjax.php


注:本文中的Translation::generateFileTranslation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。