public static function poorManTranslate($category, $text, array $params = [])
    {
        if (class_exists('Yii')) {
            return \Yii::t($category, $text, $params);
        }

        $pos = strrpos($category, '/');
        $category = $pos === false ? $category : substr($category, $pos + 1);
        $translation = @include 'messages/cs/' . $category . '.php';
        if ($translation !== null && \is_array($translation) && array_key_exists($text, $translation)) {
            $keys = array_keys($params);
            array_walk($keys, function (&$v) {
                $v = '{' . $v . '}';
            });

            return str_replace(array_values($params), $keys, $translation[$text]);
        }

        return $text;
    }
public static function poorManTranslate($category, $text, array $params = [])
    {
        if (class_exists('Yii')) {
            return \Yii::t($category, $text, $params);
        }

        $pos = strrpos($category, '/');
        $category = $pos === false ? $category : substr($category, $pos + 1);
        $translation = @include 'messages/cs/' . $category . '.php';
        if ($translation !== null && \is_array($translation) && array_key_exists($text, $translation)) {
            $keys = array_keys($params);
            array_walk($keys, function (&$v) {
                $v = '{' . $v . '}';
            });

            return str_replace(array_values($params), $keys, $translation[$text]);
        }

        return $text;
    }
public static function poorManTranslate ( $ category , $ text , array $ params = [ ] ) { if ( class_exists ( 'Yii' ) ) { return \ Yii :: t ( $ category , $ text , $ params ) ; } $ pos = strrpos ( $ category , '/' ) ; $ category = $ pos === false ? $ category : substr ( $ category , $ pos + 1 ) ; $ translation = @ include 'messages/cs/' . $ category . '.php' ; if ( $ translation !== null && \ is_array ( $ translation ) && array_key_exists ( $ text , $ translation ) ) { $ keys = array_keys ( $ params ) ; array_walk ( $ keys , function ( & $ v ) { $ v = '{' . $ v . '}' ; } ) ; return str_replace ( array_values ( $ params ) , $ keys , $ translation [ $ text ] ) ; } return $ text ; }
Translate function with automatic Yii detection

@param $category
@param $text
@param array $params
@return string
Translate function with automatic Yii detection