@param string $string Translated text
@param array  $vars   Associative array of vars to inject

@return string Translated and vared text
359266
public static function dropVars($string, $vars = [])
    {
        return strtr($string, array_flip(array_map(function ($v) {
            return ':' . $v;
        }, array_flip($vars))));
    }
334968
public function translate($string)
    {
        $args = func_get_args();
        $translated = array_shift($args);
        $extraParams = $args;
        if (count($extraParams)>0)
        {
            $translated = vsprintf($translated, $extraParams);
        }

        return $translated;
    }
1036128
private function BindExpr( $vars )
	{
		/**
		 * @var XPath2RunningContext $runningContext
		 */
		$runningContext = new XPath2RunningContext();

		/**
		 * @var ReferenceLink[] $variables
		 */
		$variables = null;
		$variableValues = null;
		if ( ! is_null( $vars ) && ! empty( $vars ) )
		{
			/**
			 * @var array[ReferenceLink] $variables
			 */
			$variables = array(); // new ReferenceLink[$vars.Count];
			$variableValues = array(); // new object[$vars.Count];
			// $array = $vars; // new KeyValuePair<QName, object>[$vars.Count];
			$array = array();
			foreach ( $vars as $key => $value )
			{
				$variables[] = $runningContext->NameBinder->PushVar( $key );
				$variableValues[] = $value;
			}
		}

		$this->context->RunningContext = $runningContext;
		$this->context->availableCollections = isset( $vars['availableCollections'] ) ? $vars['availableCollections'] : array();
		$this->context->defaultCollection = isset( $vars['defaultCollection'] ) ? $vars['defaultCollection'] : null;

		$this->exprTree->Bind();

		/**
		 * @var object[] $datapool
		 */
		$dataPool = array(); // new object[ $runningContext->NameBinder->getLength() ];
		if ( ! is_null( $variables ) )
		{
			for ( $k = 0; $k < count( $variables ); $k++ )
			{
				$variables[ $k ]->Set( $dataPool, $this->PrepareValue( $variableValues[ $k ] ) );
			}
		}
		return $dataPool;
	}
169231
protected function replaceTokens($string, array $tokens)
    {
        foreach ($tokens as $key => $value) {
            $string = str_replace('{{ '.$key.' }}', $value, $string);
        }

        return $string;
    }
313344
public function assign($name, $vars = '') {
        if (is_array($name)) {
            $this->vars = array_merge($this->vars, $name);
        }
        else {
            $this->vars[$name] = $vars;
        }

        return $this;
    }
273363
public static function fromString($string, Translations $translations, array $options = [])
    {
        $options += static::$options;

        $functions = new JsFunctionsScanner($string);
        $functions->saveGettextFunctions($translations, $options);
    }
371873
private function getTranslatedString($string)
    {
        $languageId = Registry::getLang()->getBaseLanguage();

        return Registry::getLang()->translateString(
            $string,
            $languageId,
            false
        );
    }
569466
public function bBversHTML ($string = '')
    {
                $this->parserBB->setText($string);
                $this->parserBB->parse();
                return $this->parserBB->getParsed();
    }
437149
public function render($string, array $vars = array())
    {
        $fileName = uniqid(time(), false);
        $this->generateDirectoryStructure(storage_path(), [ 'caffeinated/stubs' ]);
        $path = storage_path("caffeinated/stubs/{$fileName}");
        $this->files->put($path, $this->compiler->compileString($string));

        if (is_array($vars) && ! empty($vars)) {
            extract($vars);
        }

        ob_start();
        include($path);
        $var = ob_get_contents();
        ob_end_clean();

        $this->files->delete($path);

        return $var;
    }
203734
public static function trans($string, $replace = [])
    {
        $text = \JText::_($string);

        foreach ($replace as $key => $value) {
            $text = str_replace($key, $value, $text);
        }

        return $text;
    }
552828
public function translate($string, array $args = [], array $options = [])
    {
        $translation = new TranslationManager(new LanguageDefault([]));

        return new TranslatableMarkup($string, $args, $options, $translation);
    }
915496
public function evaluateWithVars($expression, $vars)
    {
        $vars = array_merge($vars, [
            'serializer' => $this->getSerializer(),
            'mapper' => $this->getMapper(),
        ]);
        try {
            $evaluated = $this->language->evaluate($expression, $vars);
        } catch (\Exception $e) {
            $class = get_class($e);
            throw new $class("Could not evaluate '{$expression}'. " . $e->getMessage(), $e->getCode(), $e );
        }
        return $evaluated;
    }
317191
public static function replaceTemplateVariables($string, $arrayOfVars)
    {
        self::$tempFV = $arrayOfVars;

        $ret = preg_replace_callback("/\%([A-Za-z]{1}[\w\-\_\:\.\[\]\=\#\~]+?)\%/",
                                     array('StringUtils', '_fvCallback'),
                                     $string);

        return $ret;
    }
360897
public static function variablize($string)
    {
        $string = self::camelize(self::underscore($string));
        $result = strtolower(substr($string, 0, 1));
        $variable = preg_replace('/\\w/', $result, $string, 1);
        return $variable;
    }
594711
protected static function getUserDefinedVariableString(&$string)
    {
        $returnData = [
            Tokenizer::TOKEN_VALUE => null,
            Tokenizer::TOKEN_TYPE => Tokenizer::TOKEN_TYPE_VARIABLE,
        ];

        self::setTokenValueStartingWithAtSymbolAndWrapped($returnData, $string);
        self::setTokenValueStartingWithAtSymbol($returnData, $string);

        return $returnData;
    }
162302
public function returnFormField($vars)
    {
        extract($vars);
        $ret = '';
        if (isset($mask)) $ret .= '{' . $mask . '}';
        if (isset($preHtml)) { $ret .= $preHtml; }
        if (isset($html)) {
            $ret .= $html;
        } elseif (isset($items)) {
            foreach ($items as $i) {
                $ret .= $this->returnFormField($i);
            }
        } elseif (isset($component)) {
            $view = new Kwf_Component_Renderer();
            $ret .= $view->renderComponent($component);
        }
        if (isset($postHtml)) { $ret .= $postHtml; }
        if (isset($mask)) $ret .= '{/' . $mask . '}';
        return $ret;
    }
470624
protected function replaceContent($content, $vars = [])
    {
        $find = [];
        $replace =[];
        foreach($vars as $k => $v) {
            $find[] = '#' . $k . '#';
            $replace[] = $v;
        }
        return str_ireplace($find, $replace, $content);
    }