Barryvdh\TranslationManager\Translator::get PHP Method

get() public method

Get the translation for the given key.
public get ( string $key, array $replace = [], string $locale = null, $fallback = true ) : string
$key string
$replace array
$locale string
return string
    public function get($key, array $replace = array(), $locale = null, $fallback = true)
    {
        // Get without fallback
        $result = parent::get($key, $replace, $locale, false);
        if ($result === $key) {
            $this->notifyMissingKey($key);
            // Reget with fallback
            $result = parent::get($key, $replace, $locale, $fallback);
        }
        return $result;
    }

Usage Example

 /**
  * Get the translation for the given key.
  *
  * @param string $key
  * @param array $replace
  * @param string $locale
  * @return string 
  * @static 
  */
 public static function get($key, $replace = array(), $locale = null)
 {
     return \Barryvdh\TranslationManager\Translator::get($key, $replace, $locale);
 }