src/anekdotes/I18n.php
public function dt($key, $values = [])
  {
      $namespace = '__main__';
      if (Str::contains($key, '::')) {
          list($namespace, $key) = explode('::', $key);
      }

      if (empty($this->translations)) {
          return '';
      }

      $loc = $this->getLocale();

      if (array_key_exists($namespace, $this->translations[$loc]) &&
      array_key_exists($key, $this->translations[$loc][$namespace])) {
          $translation = $this->translations[$loc][$namespace][$key];
          foreach ($values as $name => $value) {
              $translation = str_replace(':'.$name, $value, $translation);
          }

          return $translation;
      } else {
          return '';
      }
  }
public function dt($key, $values = [])
  {
      $namespace = '__main__';
      if (Str::contains($key, '::')) {
          list($namespace, $key) = explode('::', $key);
      }

      if (empty($this->translations)) {
          return '';
      }

      $loc = $this->getLocale();

      if (array_key_exists($namespace, $this->translations[$loc]) &&
      array_key_exists($key, $this->translations[$loc][$namespace])) {
          $translation = $this->translations[$loc][$namespace][$key];
          foreach ($values as $name => $value) {
              $translation = str_replace(':'.$name, $value, $translation);
          }

          return $translation;
      } else {
          return '';
      }
  }
public function dt ( $ key , $ values = [ ] ) { $ namespace = '__main__' ; if ( Str :: contains ( $ key , '::' ) ) { list ( $ namespace , $ key ) = explode ( '::' , $ key ) ; } if ( empty ( $ this -> translations ) ) { return '' ; } $ loc = $ this -> getLocale ( ) ; if ( array_key_exists ( $ namespace , $ this -> translations [ $ loc ] ) && array_key_exists ( $ key , $ this -> translations [ $ loc ] [ $ namespace ] ) ) { $ translation = $ this -> translations [ $ loc ] [ $ namespace ] [ $ key ] ; foreach ( $ values as $ name => $ value ) { $ translation = str_replace ( ':' . $ name , $ value , $ translation ) ; } return $ translation ; } else { return '' ; } }
Fetches the translation of the key based on the current locale.

@param  string  $key     translation to obtain
@param  array   $values  Values to be replaced in the translation string

@return string           Translated value
Fetches the translation of the key based on the current locale .