コード例 #1
0
 public function formatExists($string, $args = array(), $catalogue = null, $charset = null)
 {
     if (empty($charset)) {
         $charset = $this->getCharset();
     }
     $s = $this->getFormattedString(I18N_toUTF8($string, $charset), $args, $catalogue);
     return I18N_toEncoding($s, $charset);
 }
コード例 #2
0
 /**
  * Format the string. That is, for a particular string find
  * the corresponding translation. Variable subsitution is performed
  * for the $args parameter. A different catalogue can be specified
  * using the $catalogue parameter.
  * The output charset is determined by $this->getCharset();
  * @param string the string to translate.
  * @param array a list of string to substitute.
  * @param string get the translation from a particular message
  * @param string charset, the input AND output charset
  * catalogue.
  * @return string translated string.
  */
 public function format($string, $args = array(), $catalogue = null, $charset = null)
 {
     if (empty($charset)) {
         $charset = $this->getCharset();
     }
     //force args as UTF-8
     foreach ($args as $k => $v) {
         $args[$k] = I18N_toUTF8($v, $charset);
     }
     $s = $this->formatString(I18N_toUTF8($string, $charset), $args, $catalogue);
     return I18N_toEncoding($s, $charset);
 }