From 1430730bfaa704880012c73f7f73e01c2d91bd6e Mon Sep 17 00:00:00 2001 From: bim-g Date: Thu, 25 Apr 2024 21:57:40 +0200 Subject: [PATCH] [ENH] refactor application translation base module --- config/function.php | 28 ++++++++++++++++------------ config/init.php | 4 ++++ config/tra.php | 28 ++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 config/tra.php diff --git a/config/function.php b/config/function.php index ba1e11e..50745a0 100644 --- a/config/function.php +++ b/config/function.php @@ -1,6 +1,6 @@ translate($text, $translate_value); } } @@ -151,7 +155,7 @@ function url(string $path): string * @param bool $create if the file does not exist, create it * @return bool */ - function fileExists(string $filename, bool $create): bool + function fileExists(string $filename, bool $create= false): bool { if (! is_file($filename) && !file_exists($filename)){ if ($create) { @@ -165,12 +169,12 @@ function fileExists(string $filename, bool $create): bool if (! function_exists('directoryExists')) { /** - * Validate if the file exists, and in some case create it - * @param string $filename Path to the file or directory. to check files on network shares. - * @param bool $create if the file does not exist, create it + * Validate if the directory exists, and in some case create it + * @param string $filename directory Path to check files on network shares. + * @param bool $create if the directory does not exist, create it * @return bool */ - function directoryExists(string $filename, bool $create): bool + function directoryExists(string $filename, bool $create = false): bool { if (! file_exists($filename)){ if ($create) { @@ -180,4 +184,4 @@ function directoryExists(string $filename, bool $create): bool } return true; } -} \ No newline at end of file +} diff --git a/config/init.php b/config/init.php index b91c51f..b579525 100644 --- a/config/init.php +++ b/config/init.php @@ -56,6 +56,10 @@ function serverDomain(): object * Project General built-in Functions */ require_once $ROOT_DIR . '/config/function.php'; +/** + * + */ +require_once $ROOT_DIR . '/config/tra.php'; /** * Project autoload register diff --git a/config/tra.php b/config/tra.php new file mode 100644 index 0000000..fc0980e --- /dev/null +++ b/config/tra.php @@ -0,0 +1,28 @@ +translate($message, $translate_value); +} + +function tra_js(){} \ No newline at end of file