diff --git a/app/Constants.php b/app/Constants.php index a352d83cc88f..adc806c8ff1a 100644 --- a/app/Constants.php +++ b/app/Constants.php @@ -573,10 +573,20 @@ if (! defined('APP_NAME')) { // Fix for mPDF: https://github.com/kartik-v/yii2-mpdf/issues/9 define('_MPDF_TTFONTDATAPATH', storage_path('framework/cache/')); - // TODO remove these translation functions - function uctrans($text) + function uctrans($text, $data = []) { - return ucwords(trans($text)); + $locale = Session::get(SESSION_LOCALE); + $text = trans($text, $data); + + return $locale == 'en' ? ucwords($text) : $text; + } + + function utrans($text, $data = []) + { + $locale = Session::get(SESSION_LOCALE); + $text = trans($text, $data); + + return $locale == 'en' ? strtoupper($text) : $text; } // optional trans: only return the string if it's translated diff --git a/resources/views/emails/design2_html.blade.php b/resources/views/emails/design2_html.blade.php index 86534cd7d266..6ff1b8db388e 100644 --- a/resources/views/emails/design2_html.blade.php +++ b/resources/views/emails/design2_html.blade.php @@ -28,7 +28,7 @@ @if ($account->hasCustomLabel('due_date')) {{ $account->getLabel('due_date') }} {{ $account->formatDate($invoice->due_date) }} @else - {{ strtoupper(trans('texts.due_by', ['date' => $account->formatDate($invoice->due_date)])) }} + {{ utrans('texts.due_by', ['date' => $account->formatDate($invoice->due_date)]) }} @endif @endif
diff --git a/resources/views/emails/design3_html.blade.php b/resources/views/emails/design3_html.blade.php index abd344c107bd..8d3410e0c9f6 100644 --- a/resources/views/emails/design3_html.blade.php +++ b/resources/views/emails/design3_html.blade.php @@ -28,7 +28,7 @@ @if ($account->hasCustomLabel('due_date')) {{ $account->getLabel('due_date') }} {{ $account->formatDate($invoice->due_date) }} @else - {{ strtoupper(trans('texts.due_by', ['date' => $account->formatDate($invoice->due_date)])) }} + {{ utrans('texts.due_by', ['date' => $account->formatDate($invoice->due_date)]) }} @endif @endif