Localization fixes

This commit is contained in:
Hillel Coren 2017-12-07 12:33:46 +02:00
parent 8aa5f09f6b
commit d1cb62b444
8 changed files with 37 additions and 12 deletions

View File

@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Eloquent; use Eloquent;
use Str;
/** /**
* Class Currency. * Class Currency.
@ -28,4 +29,12 @@ class Currency extends Eloquent
{ {
return $this->name; return $this->name;
} }
/**
* @return mixed
*/
public function getTranslatedName()
{
return trans('texts.currency_' . Str::slug($this->name, '_'));
}
} }

View File

@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Eloquent; use Eloquent;
use Str;
/** /**
* Class InvoiceStatus. * Class InvoiceStatus.
@ -33,6 +34,14 @@ class InvoiceStatus extends Eloquent
return INVOICE_STATUS_UNPAID; return INVOICE_STATUS_UNPAID;
default: default:
return false; return false;
} }
}
/**
* @return mixed
*/
public function getTranslatedName()
{
return trans('texts.status_' . Str::slug($this->name, '_'));
} }
} }

View File

@ -178,7 +178,7 @@ class User extends Authenticatable
} elseif ($this->email) { } elseif ($this->email) {
return $this->email; return $this->email;
} else { } else {
return 'Guest'; return trans('texts.guest');
} }
} }

View File

@ -2609,6 +2609,7 @@ $LANG = array(
'copy_shipping' => 'Copy Shipping', 'copy_shipping' => 'Copy Shipping',
'copy_billing' => 'Copy Billing', 'copy_billing' => 'Copy Billing',
'quote_has_expired' => 'The quote has expired, please contact the merchant.', 'quote_has_expired' => 'The quote has expired, please contact the merchant.',
'empty_table_footer' => 'Showing 0 to 0 of 0 entries',
); );

View File

@ -55,7 +55,7 @@
{!! Former::select('expense_currency_id')->addOption('','') {!! Former::select('expense_currency_id')->addOption('','')
->data_bind('combobox: expense_currency_id') ->data_bind('combobox: expense_currency_id')
->label(trans('texts.currency_id')) ->label(trans('texts.currency_id'))
->data_placeholder(Utils::getFromCache($account->getCurrencyId(), 'currencies')->name) ->data_placeholder(Utils::getFromCache($account->getCurrencyId(), 'currencies')->getTranslatedName())
->fromQuery($currencies, 'name', 'id') !!} ->fromQuery($currencies, 'name', 'id') !!}
@if (! $isRecurring) @if (! $isRecurring)

View File

@ -124,6 +124,7 @@
"bInfo": true, "bInfo": true,
"oLanguage": { "oLanguage": {
'sEmptyTable': "{{ trans('texts.empty_table') }}", 'sEmptyTable': "{{ trans('texts.empty_table') }}",
'sInfoEmpty': "{{ trans('texts.empty_table_footer') }}",
'sLengthMenu': '_MENU_ {{ trans('texts.rows') }}', 'sLengthMenu': '_MENU_ {{ trans('texts.rows') }}',
'sInfo': "{{ trans('texts.datatable_info', ['start' => '_START_', 'end' => '_END_', 'total' => '_TOTAL_']) }}", 'sInfo': "{{ trans('texts.datatable_info', ['start' => '_START_', 'end' => '_END_', 'total' => '_TOTAL_']) }}",
'sSearch': '' 'sSearch': ''

View File

@ -138,6 +138,11 @@
var clientMap = {}; var clientMap = {};
var invoiceMap = {}; var invoiceMap = {};
var invoicesForClientMap = {}; var invoicesForClientMap = {};
var statuses = [];
@foreach (cache('invoiceStatus') as $status)
statuses[{{ $status->id }}] = "{{ $status->getTranslatedName() }}";
@endforeach
for (var i=0; i<clients.length; i++) { for (var i=0; i<clients.length; i++) {
var client = clients[i]; var client = clients[i];
@ -323,7 +328,7 @@
var invoice = list[i]; var invoice = list[i];
var client = clientMap[invoice.client.public_id]; var client = clientMap[invoice.client.public_id];
if (!client || !getClientDisplayName(client)) continue; // client is deleted/archived if (!client || !getClientDisplayName(client)) continue; // client is deleted/archived
$invoiceCombobox.append(new Option(invoice.invoice_number + ' - ' + invoice.invoice_status.name + ' - ' + $invoiceCombobox.append(new Option(invoice.invoice_number + ' - ' + statuses[invoice.invoice_status.id] + ' - ' +
getClientDisplayName(client) + ' - ' + formatMoneyInvoice(invoice.amount, invoice) + ' | ' + getClientDisplayName(client) + ' - ' + formatMoneyInvoice(invoice.amount, invoice) + ' | ' +
formatMoneyInvoice(invoice.balance, invoice), invoice.public_id)); formatMoneyInvoice(invoice.balance, invoice), invoice.public_id));
} }

View File

@ -36,19 +36,19 @@
<div id="tooltip" class="hidden"> <div id="tooltip" class="hidden">
<p> <p>
<strong><span id="tooltipTitle"></span></strong> <strong><span id="tooltipTitle"></span></strong>
<a class="pull-right" href="#" target="_blank">View</a> <a class="pull-right" href="#" target="_blank">{{ trans('texts.view') }}</a>
</p> </p>
<p>Total <span id="tooltipTotal" class="pull-right"></span></p> <p>{{ trans('texts.total') }} <span id="tooltipTotal" class="pull-right"></span></p>
<p>Balance <span id="tooltipBalance" class="pull-right"></span></p> <p>{{ trans('texts.balance') }} <span id="tooltipBalance" class="pull-right"></span></p>
<p>Age <span id="tooltipAge" class="pull-right"></span></p> <p>{{ trans('texts.age') }} <span id="tooltipAge" class="pull-right"></span></p>
</div> </div>
<form class="form-inline" role="form"> <form class="form-inline" role="form">
Group By &nbsp;&nbsp; {{ trans('texts.group_by') }} &nbsp;&nbsp;
<select id="groupBySelect" class="form-control" onchange="update()" style="background-color:white !important"> <select id="groupBySelect" class="form-control" onchange="update()" style="background-color:white !important">
<option>Clients</option> <option>{{ trans('texts.clients') }}</option>
<option>Invoices</option> <option>{{ trans('texts.invoices') }}</option>
<option>Products</option> <option>{{ trans('texts.products') }}</option>
</select> </select>
&nbsp;&nbsp; <b>{!! $message !!}</b> &nbsp;&nbsp; <b>{!! $message !!}</b>
</form> </form>