Skip to content

Commit

Permalink
Add helper function app_locale() to return current application locale…
Browse files Browse the repository at this point in the history
… with replace value
  • Loading branch information
altwaireb committed Jul 25, 2024
1 parent b18f333 commit 4f1ced6
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/Illuminate/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,25 @@
use Illuminate\Support\Sleep;
use Illuminate\Support\Str;

if (! function_exists('append_config')) {
if (! function_exists('app_locale')) {
/**
* Get the current application locale with replace value.
*
* @param string $search
* @param string $replace
* @param true $isReplace
* @return string
*/
function app_locale(string $search = '_', string $replace = '-', bool $isReplace = true): string
{
if ($isReplace){
return str_replace($search, $replace, app()->getLocale());
}
return app()->getLocale();
}
}

if (! function_exists('append_config')) {
/**
* Assign high numeric IDs to a config item to force appending.
*
Expand Down

0 comments on commit 4f1ced6

Please sign in to comment.