Prado\I18N\Translation::formatter PHP Метод

formatter() публичный статический Метод

Get the static formatter from this component.
См. также: localize()
public static formatter ( $catalogue = 'messages' ) : MessageFormat
Результат Prado\I18N\core\MessageFormat formattter.
    public static function formatter($catalogue = 'messages')
    {
        return self::$formatters[$catalogue];
    }

Usage Example

Пример #1
0
 /**
  * Translates the text with subsititution.
  * @param string text for translation
  * @param array list of substitutions
  * @return string translated text
  */
 protected function translateText($text, $subs)
 {
     $app = $this->getApplication()->getGlobalization();
     //no translation handler provided
     if (($config = $app->getTranslationConfiguration()) === null) {
         return strtr($text, $subs);
     }
     $catalogue = $this->getCatalogue();
     if (empty($catalogue) && isset($config['catalogue'])) {
         $catalogue = $config['catalogue'];
     }
     if (empty($catalogue)) {
         $catalogue = 'messages';
     }
     Translation::init($catalogue);
     $key = $this->getKey();
     if (!empty($key)) {
         $text = $key;
     }
     //translate it
     return Translation::formatter($catalogue)->format($text, $subs, $catalogue, $this->getCharset());
 }
All Usage Examples Of Prado\I18N\Translation::formatter