src/anekdotes/I18n.php
public function loadFolder($path, $namespace = '__main__')
  {
      if (is_dir($path)) {
          $files = glob($path.'*.php');
          if (!defined('DS')) {
              define('DS', DIRECTORY_SEPARATOR);
          }
          foreach ($files as $file) {
              $shell = explode(DS, $file);
              $fileName = end($shell);
              $fileName = explode('.', $fileName, -1);
              $prefix = '';
              if (count($fileName) == 2) {
                  $prefix = reset($fileName).'.';
                  $locale = end($fileName);
              } else {
                  $locale = end($fileName);
              }
              $translations = require $file;
              $translations = array_dot($translations, $prefix);

              // merge $namespace arrays with prefixed arrays if exists
              if (isset($this->translations[$locale])) {
                  if (isset($this->translations[$locale][$namespace])) {
                      $translations = array_merge($this->translations[$locale][$namespace], $translations);
                  }
              }

              // Save the values in our instance array
              $this->translations[$locale][$namespace] = $translations;
          }
      }
  }
public function loadFolder($path, $namespace = '__main__')
  {
      if (is_dir($path)) {
          $files = glob($path.'*.php');
          if (!defined('DS')) {
              define('DS', DIRECTORY_SEPARATOR);
          }
          foreach ($files as $file) {
              $shell = explode(DS, $file);
              $fileName = end($shell);
              $fileName = explode('.', $fileName, -1);
              $prefix = '';
              if (count($fileName) == 2) {
                  $prefix = reset($fileName).'.';
                  $locale = end($fileName);
              } else {
                  $locale = end($fileName);
              }
              $translations = require $file;
              $translations = array_dot($translations, $prefix);

              // merge $namespace arrays with prefixed arrays if exists
              if (isset($this->translations[$locale])) {
                  if (isset($this->translations[$locale][$namespace])) {
                      $translations = array_merge($this->translations[$locale][$namespace], $translations);
                  }
              }

              // Save the values in our instance array
              $this->translations[$locale][$namespace] = $translations;
          }
      }
  }
public function loadFolder ( $ path , $ namespace = '__main__' ) { if ( is_dir ( $ path ) ) { $ files = glob ( $ path . '*.php' ) ; if ( ! defined ( 'DS' ) ) { define ( 'DS' , DIRECTORY_SEPARATOR ) ; } foreach ( $ files as $ file ) { $ shell = explode ( DS , $ file ) ; $ fileName = end ( $ shell ) ; $ fileName = explode ( '.' , $ fileName , - 1 ) ; $ prefix = '' ; if ( count ( $ fileName ) == 2 ) { $ prefix = reset ( $ fileName ) . '.' ; $ locale = end ( $ fileName ) ; } else { $ locale = end ( $ fileName ) ; } $ translations = require $ file ; $ translations = array_dot ( $ translations , $ prefix ) ; // merge $namespace arrays with prefixed arrays if exists if ( isset ( $ this -> translations [ $ locale ] ) ) { if ( isset ( $ this -> translations [ $ locale ] [ $ namespace ] ) ) { $ translations = array_merge ( $ this -> translations [ $ locale ] [ $ namespace ] , $ translations ) ; } } // Save the values in our instance array $ this -> translations [ $ locale ] [ $ namespace ] = $ translations ; } } }
Load files in a folder to use as translations.

@param  string  $path       Path to the folder
@param  string  $namespace  Namespace the folder is in
Load files in a folder to use as translations .