Pop\I18n\I18n::translate PHP Method

translate() protected method

Translate and return the string.
protected translate ( string $str, string | array $params = null ) : mixed
$str string
$params string | array
return mixed
    protected function translate($str, $params = null)
    {
        $key = array_search($str, $this->content['source']);
        $trans = $key !== false ? $this->content['output'][$key] : $str;
        if (null !== $params) {
            if (is_array($params)) {
                foreach ($params as $key => $value) {
                    $trans = str_replace('%' . ($key + 1), $value, $trans);
                }
            } else {
                $trans = str_replace('%1', $params, $trans);
            }
        }
        return $trans;
    }