Translate Hook labels

@param $context
@param $key
@return string
432882
protected function trans($context, $key)
    {
        $message = "";

        if (array_key_exists($context, $this->messages)) {
            if (array_key_exists($key, $this->messages[$context])) {
                $message = $this->messages[$context][$key];
            }
        }

        return $message;
    }
862338
public function getName($key)
    {
        // templates do not translate the template key
        if (Structure::TYPE_SNIPPET === $this->structureType) {
            if ('template' === $key) {
                return $key;
            }
        }

        if (isset($this->translatedProperties[$key])) {
            return $this->translatedProperties[$key]->getName();
        } else {
            throw new NoSuchPropertyException($key);
        }
    }
1248184
public function map($field, $context = null)
    {
        $title = 'Please add title';

        if (array_key_exists('title', $field) && !empty($field['title'])) {
            $title = $field['title'];
        } elseif (array_key_exists('fieldName', $field) && !empty($field['fieldName'])) {
            $value = $field['fieldName'];
            // Field have dots
            if (strpos($value, '.') !== false) {
                $value = str_replace('.', ' ', str_replace('.0', '.array', $value));
            }
            $value = preg_replace('/(?<=\\w)(?=[A-Z])/', " $1", $value);
            $title = ucfirst(strtolower($value));
        }
        $field['title'] = trim($title);
        return $field;
    }
311488
public function tl(string $key, array $args = [], $lang = '')
    {
        return $this->translate($key, $args, $lang);
    }
891119
function keyTranslate( $key )
    {
        $num = $this->keyPick( $key );
        if ( $num >=0 and $num <= count( $this->Handlers ) )
        {
            $handler = $this->Handlers[$num];
            return $handler->keyTranslate( $key );
        }

        return null;
    }
1362665
static function setContextCache( $contextName, $context )
    {
        if ( $context === null )
        {
            return;
        }
        if ( isset( $GLOBALS['eZTranslationCacheTable'][$contextName] ) )
        {
            eZDebug::writeWarning( "Translation cache for context '$contextName' already exists", __METHOD__ );
        }
        else
        {
            $GLOBALS['eZTranslationCacheTable'][$contextName] = array();
        }
        $GLOBALS['eZTranslationCacheTable'][$contextName]['root'] = $context;
        $GLOBALS['eZTranslationCacheTable'][$contextName]['info'] = array( 'context' => $contextName );
    }
1237997
protected function translate($key, $default = false)
    {
        $string = $this->translator->get($key);

        if ($default !== false) {
            if ($string == $key) {
                return $default;
            }
        }

        return $string;
    }
815309
private function label_map_callback($key)
    {
        if (strpos($key, $this->ID.'.') === 0) {
            return $key;
        }

        return $this->ID.'.'.$key;
    }
696434
protected function translate($key, $params = null, $language = null) {
		return Translation :: translate($key, $params, $language, $this -> getViewmodel());
	}
381500
public function pushContext($key, $context)
    {
        $newContext = $this->getCurrentContext();
        $newContext[$key] = $context;
        $this->contextStack[] = $newContext;
    }
563160
private function getTranslationKey($key = null)
    {
        $t = $this->translator;
        $key = $t->has('helper::'.$key) ? 'helper::'.$key : $key;
        return $key;
    }
1122471
protected function translateForNewTypo3($key)
    {
        if (isset($this->localizedLabels[$this->languageKey][$key][0]['target'])) {
            $translation = $this->localizedLabels[$this->languageKey][$key][0]['target'];
        } elseif (
            ($this->alternativeLanguageKey !== '')
            && isset($this->localizedLabels[$this->alternativeLanguageKey][$key][0]['target'])
        ) {
            $translation = $this->localizedLabels[$this->alternativeLanguageKey][$key][0]['target'];
        } elseif (isset($this->localizedLabels['default'][$key][0]['target'])) {
            $translation = $this->localizedLabels['default'][$key][0]['target'];
        } else {
            $translation = $key;
        }

        return $translation;
    }
793363
public function translateContext($context, $message)
    {
        $key = $context . chr(4) . $message;
        if (isset($this->translations[$key])) {
            return $this->translations[$key];
        } else {
            return $message;
        }
    }
1291094
public function translate(string $key, array $args = [], string $lang = '')
    {
        if (!\is_string($key)) {
            throw new \InvalidArgumentException('The translate key must be a string.');
        }

        $key = \trim($key, ' ' . $this->separator);
        if ($key === '') { // '0' is equals False
            throw new \InvalidArgumentException('Cannot translate the empty key');
        }

        [$lang, $key] = $this->parseKey($key, $lang);

        // translate form current language. if not found, translate form fallback language.
        if (($value = $this->findTranslationText($key)) === null) {
            $value = $this->transByFallbackLang($key);

            // no translate text
            if ((string)$value === '') {
                if (!empty($args['__default'])) {
                    return $args['__default'];
                }

                return \ucfirst(Str::toSnake(\str_replace(['-', '_'], ' ', $key), ' '));
            }
        }

        return $args ? sprintf($value, ...$args) : $value;
    }
513160
public function translate($key, $translation, $locale = null) {
        $this->translations[$this->locale($locale)][$key] = $translation;

        return $translation;
    }
1108991
protected function createForeignKey($key) {
		$res = "\n\t\$table->addForeignKeyConstraint('".$key->getForeignTableName()."', ".$this->outputPHP($key->getLocalColumns(), 2).", ".$this->outputPHP($key->getForeignColumns(), 2).
			", ".$this->outputPHP($key->getOptions(), 2).", '".$key->getName()."');";

		return $res;
	}
783098
private static function getCoroutineContext(string $key)
    {
        $coroutineId = self::getCoroutineId();
        if (!isset(self::$context[$coroutineId])) {
            return null;
        }

        $coroutineContext = self::$context[$coroutineId];
        if (isset($coroutineContext[$key])) {
            return $coroutineContext[$key];
        }
        return null;
    }