コード例 #1
0
 public function GetLogMessage($msgId, $params = "")
 {
     $message = isset($this->objectMessages[$msgId]) ? $this->objectMessages[$msgId] : constant($msgId);
     $message = I18n::t($message, $msgId, 'eventlog');
     $params = unserialize($params);
     $result = vsprintf($message, $params);
     return $result;
 }
コード例 #2
0
 /**
  * Get message from CONSTANT, translate and format it
  * @param string $msgId ID if constant
  * @param array $params parameter for format (use vsprintf)
  * @return string
  */
 public static function getMessage($msgId, $params = array())
 {
     $message = constant($msgId);
     if (isset($message)) {
         $message = I18n::t($message, $msgId, 'system');
         $result = vsprintf($message, $params);
     }
     return $result;
 }
コード例 #3
0
 public function getMessage($messageId, $params = array())
 {
     $message = isset($this->objectMessages[$messageId]) ? $this->objectMessages[$messageId] : @constant($messageId);
     if (!$message) {
         $message = $messageId;
     } else {
         //$message = I18n::getInstance()->translate($message);
         $message = I18n::t($message, $messageId, $this->getModuleName($this->objectName));
     }
     return @vsprintf($message, $params);
 }
コード例 #4
0
 protected function translate()
 {
     $module = $this->getModuleName($this->objectName);
     $this->title = I18n::t($this->title, $this->getTransKey('Title'), $module);
     $this->objectDescription = I18n::t($this->objectDescription, $this->getTransKey('Description'), $module);
 }
コード例 #5
0
ファイル: WebPage.php プロジェクト: openbizx/openbizx-cubix
 protected function translate()
 {
     $module = $this->getModuleName($this->objectName);
     $trans_string = I18n::t($this->title, $this->getTransKey('Title'), $module, $this->getTransPrefix());
     if ($trans_string) {
         $this->title = $trans_string;
     }
     $trans_string = I18n::t($this->objectDescription, $this->getTransKey('Description'), $module, $this->getTransPrefix());
     if ($trans_string) {
         $this->objectDescription = $trans_string;
     }
 }
コード例 #6
0
 protected function translate()
 {
     $module = substr($this->viewName, 0, intval(strpos($this->viewName, '.')));
     //echo $this->getTransKey('Description');
     $this->objectDescription = I18n::t($this->objectDescription, $this->getTransKey('Description'), $module);
 }
コード例 #7
0
 protected function translateList($list, $tag)
 {
     $module = $this->getModuleName($this->selectFrom);
     if (empty($module)) {
         $module = $this->getModuleName($this->formName);
     }
     for ($i = 0; $i < count($list); $i++) {
         $key = 'SELECTION_' . strtoupper($tag) . '_' . $i . '_TEXT';
         $list[$i]['txt'] = I18n::t($list[$i]['txt'], $key, $module, $this->getTransLOVPrefix());
     }
     return $list;
 }
コード例 #8
0
 protected function getChangeLogMessage($messageId)
 {
     $message = isset($this->changeLogMessages[$messageId]) ? $this->changeLogMessages[$messageId] : constant($messageId);
     $message = I18n::t($message, $messageId, "changelog");
     return @vsprintf($message, $params);
 }
コード例 #9
0
 protected function translate()
 {
     $module = $this->getModuleName($this->formName);
     if (!empty($this->text)) {
         $this->text = I18n::t($this->text, $this->getTransKey('Text'), $module);
     }
     if (!empty($this->label)) {
         $this->label = I18n::t($this->label, $this->getTransKey('Label'), $module);
     }
     if (!empty($this->key)) {
         $this->key = I18n::t($this->key, $this->getTransKey('Label'), $module);
     }
     if (!empty($this->objectDescription)) {
         $this->objectDescription = I18n::t($this->objectDescription, $this->getTransKey('Description'), $module);
     }
     if (!empty($this->defaultValue)) {
         $this->defaultValue = I18n::t($this->defaultValue, $this->getTransKey('DefaultValue'), $module);
     }
     if (!empty($this->elementSet)) {
         $this->elementSet = I18n::t($this->elementSet, $this->getTransKey('ElementSet'), $module);
     }
 }
コード例 #10
0
ファイル: block.t.php プロジェクト: openbizx/openbizx-cubix
/**
 * Smarty block function, provides gettext support for smarty.
 *
 * The block content is the text that should be translated.
 *
 * Any parameter that is sent to the function will be represented as %n in the translation text, 
 * where n is 1 for the first parameter. The following parameters are reserved:
 *   - escape - sets escape mode:
 *       - 'html' for HTML escaping, this is the default.
 *       - 'js' for javascript escaping.
 *       - 'url' for url escaping.
 *       - 'no'/'off'/0 - turns off escaping
 *   - plural - The plural version of the text (2nd parameter of ngettext())
 *   - count - The item count for plural mode (3rd parameter of ngettext())
 */
function smarty_block_t($params, $text, &$smarty)
{
    $text = stripslashes($text);
    // set escape mode
    if (isset($params['escape'])) {
        $escape = $params['escape'];
        unset($params['escape']);
    }
    // set plural version
    if (isset($params['plural'])) {
        $plural = $params['plural'];
        unset($params['plural']);
        // set count
        if (isset($params['count'])) {
            $count = $params['count'];
            unset($params['count']);
        }
    }
    //debut modif lolo
    //utilisons Zend_translate
    // use plural if required parameters are set
    /*if (isset($count) && isset($plural)) {
    		$text = ngettext($text, $plural, $count);
    	} else { // use normal
    		$text = gettext($text);
    	}*/
    //$text=I18n::getInstance()->translate($text);
    $module = $smarty->_tpl_vars['module'];
    $key = strtoupper('STRING_' . md5($text));
    $text = I18n::t($text, $key, $module);
    //fin modif lolo
    // run strarg if there are parameters
    if (count($params)) {
        $text = smarty_gettext_strarg($text, $params);
    }
    if (!isset($escape) || $escape == 'html') {
        // html escape, default
        $text = nl2br(htmlspecialchars($text));
    } elseif (isset($escape)) {
        switch ($escape) {
            case 'javascript':
            case 'js':
                // javascript escape
                $text = str_replace('\'', '\\\'', stripslashes($text));
                break;
            case 'url':
                // url escape
                $text = urlencode($text);
                break;
        }
    }
    $text = str_replace('\\n', "<br/>", $text);
    return $text;
}
コード例 #11
0
ファイル: Element.php プロジェクト: openbizx/openbizx-cubix
 protected function translate()
 {
     $module = substr($this->_formName, 0, intval(strpos($this->_formName, '.')));
     if (!empty($this->contextMenu)) {
         $this->contextMenu = I18n::t($this->contextMenu, $this->getTransKey('ContextMenu'), $module);
     }
 }
コード例 #12
0
 protected function translate()
 {
     $module = $this->module;
     if (!empty($this->objectName)) {
         $this->objectName = I18n::t($this->objectName, $this->getTransKey('Title'), $module);
     }
     if (!empty($this->objectDescription)) {
         $this->objectDescription = I18n::t($this->objectDescription, $this->getTransKey('Description'), $module);
     }
 }