private static function _config($file) { global $config; $path = CONFIG_DIR . suffix($file, ".php"); if (!is_file($path)) { return false; } if (!isImport($path)) { require_once restorationPath($path); self::$config = $config; } }
function lang(string $file, string $str = NULL, $changed = NULL) { global $lang; $file = (Config::get('Language', 'shortCodes')[getLang()] ?? 'English') . '/' . suffix($file, '.php'); $langDir = LANGUAGES_DIR . $file; $sysLangDir = INTERNAL_LANGUAGES_DIR . $file; $commonLangDir = EXTERNAL_LANGUAGES_DIR . $file; if (is_file($langDir) && !isImport($langDir)) { $lang[$file] = (require_once $langDir); } elseif (is_file($sysLangDir) && !isImport($sysLangDir)) { $lang[$file] = (require_once $sysLangDir); } elseif (is_file($commonLangDir) && !isImport($commonLangDir)) { $lang[$file] = (require_once $commonLangDir); } if (empty($str) && isset($lang[$file])) { return $lang[$file]; } elseif (!empty($lang[$file][$str])) { $langstr = $lang[$file][$str]; } else { return false; } if (!is_array($changed)) { if (strstr($langstr, "%") && !empty($changed)) { return str_replace("%", $changed, $langstr); } else { return $langstr; } } else { if (!empty($changed)) { $values = []; foreach ($changed as $key => $value) { $keys[] = $key; $values[] = $value; } return str_replace($keys, $values, $langstr); } else { return $langstr; } } }