mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fix for module column headers
This commit is contained in:
parent
82e2331e73
commit
989d55d692
@ -923,11 +923,16 @@ if (!defined('CONTACT_EMAIL')) {
|
||||
$text = $entityType;
|
||||
}
|
||||
|
||||
// check if this has been translated in a module language file
|
||||
if ( ! Utils::isNinjaProd() && $module = Module::find($entityType)) {
|
||||
return trans("{$module->getLowerName()}::texts.{$text}");
|
||||
} else {
|
||||
return trans("texts.{$text}");
|
||||
$key = "{$module->getLowerName()}::texts.{$text}";
|
||||
$value = trans($key);
|
||||
if ($key != $value) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
return trans("texts.{$text}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ class Utils
|
||||
return substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') + 1);
|
||||
}
|
||||
|
||||
public static function trans($input)
|
||||
public static function trans($input, $module = false)
|
||||
{
|
||||
$data = [];
|
||||
|
||||
@ -274,7 +274,11 @@ class Utils
|
||||
if ($field == 'checkbox') {
|
||||
$data[] = $field;
|
||||
} elseif ($field) {
|
||||
$data[] = trans("texts.$field");
|
||||
if ($module) {
|
||||
$data[] = mtrans($module, $field);
|
||||
} else {
|
||||
$data[] = trans("texts.$field");
|
||||
}
|
||||
} else {
|
||||
$data[] = '';
|
||||
}
|
||||
|
@ -63,7 +63,7 @@
|
||||
|
||||
|
||||
{!! Datatable::table()
|
||||
->addColumn(Utils::trans($datatable->columnFields()))
|
||||
->addColumn(Utils::trans($datatable->columnFields(), $datatable->entityType))
|
||||
->setUrl(url('api/' . Utils::pluralizeEntityType($entityType) . '/' . (isset($clientId) ? $clientId : (isset($vendorId) ? $vendorId : ''))))
|
||||
->setCustomValues('rightAlign', isset($rightAlign) ? $rightAlign : [])
|
||||
->setCustomValues('entityType', Utils::pluralizeEntityType($entityType))
|
||||
|
Loading…
x
Reference in New Issue
Block a user