Translates a string

@access public
@param string string to be translated
@return string translated string (or original, if not found)
492166
public function get($string = null, $range = '') {
        if($range) {
            $lang = isset($this->range[$range]) ? $this->range[$range] : [];
        }
        else {
            $lang = $this->lang;
        }

        foreach ($lang as $lg) {
            $count = 0;
            $string = $lg->translate($string, $count);
            if (-1 != $count) {
                break;
            }
        }

        return $string;
    }
67019
public static function decode($string)
    {
        return ($string === self::NULL) ? null : strtr($string, self::$decodeMap);
    }
415874
protected function convertToStringOrBoolean($string)
    {
        $result = (string) $string;
        $lowerString = strtolower($result);

        if('true' === $lowerString)
        {
            $result = true;
        }
        elseif('false' === $lowerString)
        {
            $result = false;
        }

        return $result;
    }
269949
function translate($str, $tokens = [])
    {
        if (array_key_exists($str, $this->translation)) {
            $str = $this->translation[$str];
        }
        if (is_array($tokens) && sizeof($tokens) > 0) {
            $str = vsprintf($str, $tokens);
        }

        return $str;
    }
1061645
public static function transliterate($string) {
        $g11n = G11n::registry();

        if (!$g11n->isEnabled()) {
            return $string;
        }

        return static::cache([__METHOD__, $string], function() use ($string, $g11n) {
            $inflections = $g11n->current()->getInflectionRules();

            if (!$inflections || empty($inflections['transliteration'])) {
                return $string;
            }

            // Replace with ASCII characters
            $transliterations = $inflections['transliteration'];
            $string = str_replace(array_keys($transliterations), array_values($transliterations), $string);

            // Remove any left over non 7bit ASCII
            return preg_replace('/[^\x09\x0A\x0D\x20-\x7E]/', '', $string);
        });
    }
1080992
public function loadString($string)
    {
        $this->sourceString = $string;

        if ($this->config->allowPhpScripts === false) {
            $this->sourceString = preg_replace(
                '/<\\?.*(\\?>|$)/Us',
                '',
                str_replace('<?=', '<?php echo ', $this->sourceString)
            );
        }

        $this->sourceString = str_replace(
            [
                '__DIR__',
                '__FILE__',
            ],
            [
                "'" . $this->getSourceFileDirectory() . "'",
                "'" . $this->getSourceFilePath() . "'",
            ],
            $this->sourceString
        );

        return empty($this->sourceString);
    }
477331
public function translate($key)
    {
        $normalizeKey = $this->normalize($key);

        if ($this->exists($normalizeKey, false)) {
            $string = $this->strings[$normalizeKey];

            // In debug mode, we notice user this is a translated string.
            if ($this->debug) {
                $string = '**' . $string . '**';
            }

            // Store used keys
            if (!in_array($normalizeKey, $this->used)) {
                $this->used[] = $normalizeKey;
            }

            return $string;
        }

        // In debug mode, we notice user this is a translating string but not found.
        if ($this->debug) {
            $this->orphans[$normalizeKey] = $this->backtrace($normalizeKey, $this->traceLevelOffset + 2);

            $key = '??' . $key . '??';
        }

        return $key;
    }
119341
protected function execute($string)
    {
        foreach ($this->patternsAndReplacements as $patternAndReplacement) {
            $tmp = preg_replace("/".$patternAndReplacement->pattern."/s", $patternAndReplacement->replacement, $string);
            if ($tmp === null) {
                InvalidExpression::invalidRegex($patternAndReplacement->pattern, $patternAndReplacement->replacement);
            } else {
                $string = $tmp;
            }
        }
        
        return $string;
    }
825054
public static function get($string)
    {
        $vars = func_get_args();

        if (array_key_exists($string, self::$strings)) {
            $vars[0] = self::$strings[$string];
            return call_user_func_array('sprintf', $vars);
        }

        return '%%MISSING STRING: ' . $string . '%%';
    }
447695
private function prepareMessage(string $string): string
    {
        if (Translator::isMessage($string)) {
            $string = substr($string, 2, -2);
        }

        return $string;
    }
108987
public function generate($string)
    {
        if ($this->romanization === true) {
            $string = $this->romanize($string);
        }

        $string = $this->lowercase($string);
        $string = $this->removeUndesiredChars($string);
        $string = $this->trim($string);
        $string = $this->replaceWt($string);
        $string = $this->removeExtraDashes($string);

        return $string;
    }
58293
public static function strtoupper($string)
    {
        if(!defined('UTF8_NOMBSTRING') && function_exists('mb_strtolower'))
            return mb_strtoupper($string,'utf-8');

        //global $utf8_lower_to_upper;
        $uni = self::utf8_to_unicode($string);
        $cnt = count($uni);
        for ($i=0; $i < $cnt; $i++){
            if(self::$utf8_lower_to_upper[$uni[$i]]){
                $uni[$i] = self::$utf8_lower_to_upper[$uni[$i]];
            }
        }
        return self::unicode_to_utf8($uni);
    }
248678
protected function replaceVariables($string)
    {
        do {
            $original = $string;

            $string = $this->searchAndReplaceVariables($string);
        } while ($original !== $string);

        return $string;
    }
966845
public static function stringToValue($string)
	{
		if($string == '')
		{
			return $string;
		}
		if(is_float($string))
		{
			return (float) $string;
		}
		if(is_int($string))
		{
			return (int) $string;
		}
		if(strtolower($string) == 'true')
		{
			return true;
		}
		if(strtolower($string) == 'false')
		{
			return false;
		}
		if(strtolower($string) == 'null')
		{
			return NULL;
		}
		
		return $string;
	}
973926
protected function _translate($string, $context = null)
    {
        if (!(($translator = $this->_getTranslator()) instanceof StringTranslatorInterface)) {
            return $string;
        }

        return $translator->translate($string, $context);
    }
989743
public function get($string)
    {
        $lowercase = strtolower($string);

        if (!parent::has($lowercase))
        {
            if (isset($this->_aliases[$lowercase])) {
                $key = $this->_aliases[$lowercase];
            }
            else if(!JFactory::getLanguage()->hasKey($string))
            {
                if (substr($string, 0, strlen($this->getPrefix())) === $this->getPrefix()) {
                    $key = $string;
                } else {
                    //Gets a key from the catalogue and prefixes it
                    $key = $this->getPrefix().$this->generateKey($string);
                }
            }
            else $key = $string;

            $this->set($lowercase, JFactory::getLanguage()->_($key));
        }

        return parent::get($lowercase);
    }
612150
public function transform($string)
    {
        $string = $this->transliterator->transliterate($string);
        if ($string === false) {
            throw new UnexpectedValueException($this->transliterator->getErrorMessage(), $this->transliterator->getErrorCode());
        }
        return $string;
    }