diff --git a/config/function.php b/config/function.php index b3b03db..8d42063 100644 --- a/config/function.php +++ b/config/function.php @@ -3,6 +3,9 @@ * Copyright (c) 2023. Wepesi. */ +use Wepesi\Core\I18n; +use Wepesi\Core\Session; + /** * @param string $dir * @return array @@ -104,3 +107,16 @@ function appDirSeparator(string $path): string if ((substr(PHP_OS, 0, 3)) === 'WIN') $new_path = str_replace("\\", '/', $path); return $new_path; } + +/** + * translate your text + * @param string $message + * @param string|array $value + * @return string + */ +function tra(string $message, $value = null): string +{ + $i18n = new i18n(Session::get('lang')); + $translate_value = !is_array($value) ? [$value] : $value; + return $i18n->translate($message, $translate_value); +} \ No newline at end of file