mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 10:34:30 -04:00
Merge pull request #3011 from dicarlosystems/allow-mtrans-to-replace
Allow module trans helper to replace values (#3006)
This commit is contained in:
commit
0524ac764d
@ -695,7 +695,7 @@ if (! defined('APP_NAME')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// include modules in translations
|
// include modules in translations
|
||||||
function mtrans($entityType, $text = false)
|
function mtrans($entityType, $text = false, $replace = [])
|
||||||
{
|
{
|
||||||
if (! $text) {
|
if (! $text) {
|
||||||
$text = $entityType;
|
$text = $entityType;
|
||||||
@ -704,7 +704,7 @@ if (! defined('APP_NAME')) {
|
|||||||
// check if this has been translated in a module language file
|
// check if this has been translated in a module language file
|
||||||
if (! Utils::isNinjaProd() && $module = Module::find($entityType)) {
|
if (! Utils::isNinjaProd() && $module = Module::find($entityType)) {
|
||||||
$key = "{$module->getLowerName()}::texts.{$text}";
|
$key = "{$module->getLowerName()}::texts.{$text}";
|
||||||
$value = trans($key);
|
$value = trans($key, $replace);
|
||||||
if ($key != $value) {
|
if ($key != $value) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user