core/Lang.class.php
private static function loadPackage(string $package): stdClass {
    $language = new stdClass();
    if (!empty($package)) {
      $filename = null;
      if ($packageData = explode(":", $package)) {
        if (!empty($packageData[0])) {
          $filename .= Lang::$root[$packageData[0]];
        }
        if (!empty($packageData[1])) {
          $filename .= DIRECTORY_SEPARATOR . $packageData[1];
        }
        $pathaname = Lang::selectPackage($filename);
        if (file_exists($pathaname)) {
          $pathaname = Path::replaceOSSeparator($pathaname);
          $decode = json_decode(file_get_contents((new SplFileObject($pathaname, "r"))->getPathname()));
          $language = (JSON_ERROR_NONE == json_last_error()) ? $decode : $language;
        }
      }
    }
    return $language;
  }
private static function loadPackage(string $package): stdClass {
    $language = new stdClass();
    if (!empty($package)) {
      $filename = null;
      if ($packageData = explode(":", $package)) {
        if (!empty($packageData[0])) {
          $filename .= Lang::$root[$packageData[0]];
        }
        if (!empty($packageData[1])) {
          $filename .= DIRECTORY_SEPARATOR . $packageData[1];
        }
        $pathaname = Lang::selectPackage($filename);
        if (file_exists($pathaname)) {
          $pathaname = Path::replaceOSSeparator($pathaname);
          $decode = json_decode(file_get_contents((new SplFileObject($pathaname, "r"))->getPathname()));
          $language = (JSON_ERROR_NONE == json_last_error()) ? $decode : $language;
        }
      }
    }
    return $language;
  }
private static function loadPackage ( string $ package ) : stdClass { $ language = new stdClass ( ) ; if ( ! empty ( $ package ) ) { $ filename = null ; if ( $ packageData = explode ( ":" , $ package ) ) { if ( ! empty ( $ packageData [ 0 ] ) ) { $ filename .= Lang :: $ root [ $ packageData [ 0 ] ] ; } if ( ! empty ( $ packageData [ 1 ] ) ) { $ filename .= DIRECTORY_SEPARATOR . $ packageData [ 1 ] ; } $ pathaname = Lang :: selectPackage ( $ filename ) ; if ( file_exists ( $ pathaname ) ) { $ pathaname = Path :: replaceOSSeparator ( $ pathaname ) ; $ decode = json_decode ( file_get_contents ( ( new SplFileObject ( $ pathaname , "r" ) ) -> getPathname ( ) ) ) ; $ language = ( JSON_ERROR_NONE == json_last_error ( ) ) ? $ decode : $ language ; } } } return $ language ; }
- Identify package and load package language
@param string $package Path name package language
@return stdClass Object with language translate
- Identify package and load package language