diff --git a/app/functions.php b/app/functions.php new file mode 100644 index 0000000..dad2f67 --- /dev/null +++ b/app/functions.php @@ -0,0 +1,40 @@ +getLocale() . '.json'); + + return File::exists($path) ? json_decode(File::get($path), true) : []; + }; + + if (is_null($key)) { + return $key; + } + + if (is_string($key)) { + $all = $allDefinedTranslation(); + + if (!array_key_exists($key, $all)) { + $all[$key] = $key; + + $path = lang_path(app()->getLocale() . '.json'); + + File::put($path, json_encode($all, JSON_PRETTY_PRINT)); + } + } + + return trans($key, $replace, $locale); + } +} \ No newline at end of file diff --git a/public/index.php b/public/index.php index 1d69f3a..4dd1860 100644 --- a/public/index.php +++ b/public/index.php @@ -20,6 +20,8 @@ if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) require $maintenance; } +require __DIR__ . '/../app/functions.php'; + /* |-------------------------------------------------------------------------- | Register The Auto Loader