Skip to content

Commit

Permalink
Merge pull request #169 from kivudesign/version_boss
Browse files Browse the repository at this point in the history
[ENH] add simplify translation funtion
  • Loading branch information
bim-g authored Feb 25, 2024
2 parents 1985b3b + d42f8f5 commit 5359c24
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions config/function.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Copyright (c) 2023. Wepesi.
*/

use Wepesi\Core\I18n;
use Wepesi\Core\Session;

/**
* @param string $dir
* @return array
Expand Down Expand Up @@ -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);
}

0 comments on commit 5359c24

Please sign in to comment.