示例#1
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;
 }
示例#2
0
 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;
     }
 }
示例#3
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());
     }
 }
示例#4
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);
 }
示例#5
0
 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);
     }
 }