Prado\I18N\core\MessageFormat::formatString PHP Метод

formatString() защищенный Метод

Do string translation.
protected formatString ( $string, $args = [], $catalogue = null ) : string
Результат string translated string.
    protected function formatString($string, $args = array(), $catalogue = null)
    {
        if (empty($catalogue)) {
            if (empty($this->Catalogue)) {
                $catalogue = 'messages';
            } else {
                $catalogue = $this->Catalogue;
            }
        }
        $this->loadCatalogue($catalogue);
        if (empty($args)) {
            $args = array();
        }
        foreach ($this->messages[$catalogue] as $variant) {
            // foreach of the translation units
            foreach ($variant as $source => $result) {
                // we found it, so return the target translation
                if ($source == $string) {
                    //check if it contains only strings.
                    if (is_string($result)) {
                        $target = $result;
                    } else {
                        $target = $result[0];
                    }
                    //found, but untranslated
                    if (empty($target)) {
                        return $this->postscript[0] . strtr($string, $args) . $this->postscript[1];
                    } else {
                        return strtr($target, $args);
                    }
                }
            }
        }
        // well we did not find the translation string.
        $this->source->append($string);
        return $this->postscript[0] . strtr($string, $args) . $this->postscript[1];
    }