Label translation helper

@param string 		$key
@param array 			$params
@return string
427462
public function __( $key, $params = array() )
	{
		$namespace = explode( "\\", get_called_class() );

		$class = strtolower( 'model/'.str_replace( '_', '/', array_pop( $namespace ) ) );

		$namespace = implode( "\\", $namespace );

		if ( $namespace )
		{
				$class = $namespace.'::'.$class;
		}

		return __( $class.'.label.'.$key, $params );
	}
1151584
public function translate($text, array $params = [], $source = 'app')
    {
        $messages = $this->load($source);
        $message = vsprintf(isset($messages[$text]) ? $messages[$text] : $text, $params);

        return $message ? $message : $text;
    }
746926
public static function translate($key, $params = [], $language = null, Viewmodel $viewmodel = null) {
		
		$identifier = null;

		if(null !== $viewmodel) {
			$identifier = static :: load($viewmodel);
		}

		if(null === $key) {
			$key = '';
		}

		//Check if key is a string
		if(false === is_string($key)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($key)), E_USER_ERROR);
		}

		//Check if params is an array
		if(null !== $params && false === is_array($params)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($params)), E_USER_ERROR);
		}

		//Check if language is a string
		if(null !== $language && false === is_string($language)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($language)), E_USER_ERROR);
		}

		//Set default language if non given
		if(null === $language) {
			$language = static :: $language;
		}

		//If identifier is known (usually with a viewmodel as last param)
		if(null !== $identifier) {

			if(true === isset(static :: $translations[$identifier], static :: $translations[$identifier][$language])) {

				if(true === isset(static :: $translations[$identifier][$language][$key])) {
					return vsprintf(static :: $translations[$identifier][$language][$key], $params);
				}
			}
		}

		//Check the full resource for the translation
		foreach(static :: $translations as $translation) {

			if(true === isset($translation[$language][$key])) {
				return vsprintf($translation[$language][$key], $params);
			}
		}

		//No translation found
		return vsprintf($key, $params);
	}
1243388
public function trans(string $key, array $args = [], $lang = '')
    {
        return $this->translate($key, $args, $lang);
    }
686618
public function getstr($key, $params=[], $alternative=null, $lang=null){

        if (!$lang) {
            $lang = $this->locale;
        }

        if (!$alternative){
            $alternative = $key;
        }

        return \vsprintf(isset($this->_languages[$lang][$key]) ? $this->_languages[$lang][$key]:$alternative, $params);
    }
532905
public static String getString(String key, Object... params) {
		String message = getStringSafely(key);
		if (params != null && params.length > 0) {
			return MessageFormat.format(message, params);
		} else {
			return message;
		}
	}
4708
public function indexKey(string $projectKey, string $keyId, array $params = [])
    {
        if (isset($params['tags'])) {
            $params['q'] = 'tags:'.$params['tags'];
            unset($params['tags']);
        }

        $response = $this->httpGet(sprintf('/api/v2/projects/%s/keys/%s/translations', $projectKey, $keyId), $params);

        if (!$this->hydrator) {
            return $response;
        }

        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, Index::class);
    }
1121600
public static function getRequired(
        array $params,
        string $key,
        $context = null
    ) {
        self::assertHas($params, $key, $context);

        return $params[$key];
    }
1342738
public static function /*@codingStandardsIgnoreStart*/__/*@codingStandardsIgnoreEnd*/($key, array $params = [], $domain = 'messages', $locale = null)
    {
        return new self($key, $params, $domain, $locale);
    }
652776
protected static function buildErrorMessage(
        array $params,
        string $key,
        $message = null,
        $context = null
    ): string {
        if (empty($message)) {
            $message = 'There was an error with a key: (' . $key . ')'
                . ' in params: (' . json_encode($params, 0, 3) . ')';
        }

        $contextType = gettype($context);

        if (is_object($context)) {
            $context = get_class($context);
        }

        if ($context === null) {
            return $message;
        }

        // Clear json_last_error()
        json_encode(null);

        $json = json_encode($context, JSON_PRETTY_PRINT, self::$depth);

        if (JSON_ERROR_NONE !== json_last_error()) {
            return $message;
        }

        return $message . " - Context ({$contextType}): \n" . $json;
    }
764822
protected function select($key, $params)
    {
        $select = $selectValue = '';
        $options = $params['options'];
        unset($params['options']);

        $selected = null;
        if (isset($params['selected'])) {
            $selected = $params['selected'];
            unset($params['selected']);
        }

        list($elClass, $params) = $this->highlightErrorElement($key, $params);

        $select .= '<select'." name='".$key."' ".$this->attributes($params).' '.$elClass.'>'.PHP_EOL;

        /*
         | Build select box options and return as string
         |
         */
        $select .= $this->getSelectOptions($options, $selected);
        $select .= '</select>'.PHP_EOL;

        $this->elements[static::$formHolder[static::$formName]][$key] = $select;

        return $this;
    }
237068
public String format( String key, Object... params )
    {
        try
        {
            MessageFormat formatter = new MessageFormat( bundle.getString( key ) );
            return formatter.format( params );
        }
        catch (MissingResourceException ex)
        {
            return key;
        }
    }
324184
public function make($key, $params = [])
    {
        if($this->aliasExist($key)) {
            return $this->make($this->aliases[$key], $params);
        }

        if(is_callable($key)) {
            return call_user_func_array($key, $this->resolveCallback($key, $params));
        }

        return $this->resolveClass($key, $params);
    }
837098
protected function translate($key, array $arguments = [])
    {
        return \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate(
            'LLL:EXT:ke_search/Resources/Private/Language/locallang_mod.xml:' . $key,
            'KeSearch',
            $arguments
        );
    }
912518
private function translate($key, $translations)
    {
        if ($translations != null && isset($translations[$key])) {
            return $translations[$key];
        }

        return $key;
    }
832130
public static function isEmpty(
        array $params,
        string $key
    ) {
        return empty(self::get($params, $key, null));
    }
545707
private function translate($key, $translations)
    {
        if (!is_null($translations) && isset($translations[$key])) {
            return $translations[$key];
        }

        return $key;
    }