Cast all translations to strings.

This commit is contained in:
James Cole
2018-07-15 09:38:49 +02:00
parent 369839e012
commit 7b41c5b301
99 changed files with 335 additions and 336 deletions

View File

@@ -50,7 +50,7 @@ class CreateController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts'));
app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(AccountRepositoryInterface::class);
@@ -70,7 +70,7 @@ class CreateController extends Controller
$what = $what ?? 'asset';
$defaultCurrency = app('amount')->getDefaultCurrency();
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
$subTitle = trans('firefly.make_new_' . $what . '_account');
$subTitle = (string)trans('firefly.make_new_' . $what . '_account');
$roles = [];
foreach (config('firefly.accountRoles') as $role) {
$roles[$role] = (string)trans('firefly.account_role_' . $role);

View File

@@ -50,7 +50,7 @@ class DeleteController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts'));
app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(AccountRepositoryInterface::class);
@@ -67,7 +67,7 @@ class DeleteController extends Controller
public function delete(Account $account)
{
$typeName = config('firefly.shortNamesByFullName.' . $account->accountType->type);
$subTitle = trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]);
$subTitle = (string)trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]);
$accountList = ExpandedForm::makeSelectListWithEmpty($this->repository->getAccountsByType([$account->accountType->type]));
unset($accountList[$account->id]);

View File

@@ -53,7 +53,7 @@ class EditController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts'));
app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -76,7 +76,7 @@ class EditController extends Controller
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
{
$what = config('firefly.shortNamesByFullName')[$account->accountType->type];
$subTitle = trans('firefly.edit_' . $what . '_account', ['name' => $account->name]);
$subTitle = (string)trans('firefly.edit_' . $what . '_account', ['name' => $account->name]);
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
$roles = [];
foreach (config('firefly.accountRoles') as $role) {

View File

@@ -50,7 +50,7 @@ class IndexController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts'));
app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(AccountRepositoryInterface::class);
@@ -68,7 +68,7 @@ class IndexController extends Controller
public function index(Request $request, string $what)
{
$what = $what ?? 'asset';
$subTitle = trans('firefly.' . $what . '_accounts');
$subTitle = (string)trans('firefly.' . $what . '_accounts');
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
$types = config('firefly.accountTypesByIdentifier.' . $what);
$collection = $this->repository->getAccountsByType($types);

View File

@@ -64,7 +64,7 @@ class ReconcileController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts'));
app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(JournalRepositoryInterface::class);
$this->accountRepos = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -85,7 +85,7 @@ class ReconcileController extends Controller
return redirect(route('transactions.edit', [$journal->id]));
}
// view related code
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
$subTitle = (string)trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
// journal related code
$pTransaction = $this->repository->getFirstPosTransaction($journal);
@@ -126,7 +126,7 @@ class ReconcileController extends Controller
return $this->redirectToOriginalAccount($account);
}
if (AccountType::ASSET !== $account->accountType->type) {
session()->flash('error', trans('firefly.must_be_asset_account'));
session()->flash('error', (string)trans('firefly.must_be_asset_account'));
return redirect(route('accounts.index', [config('firefly.shortNamesByFullName.' . $account->accountType->type)]));
}
@@ -153,7 +153,7 @@ class ReconcileController extends Controller
$startBalance = round(app('steam')->balance($account, $startDate), $currency->decimal_places);
$endBalance = round(app('steam')->balance($account, $end), $currency->decimal_places);
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
$subTitle = trans('firefly.reconcile_account', ['account' => $account->name]);
$subTitle = (string)trans('firefly.reconcile_account', ['account' => $account->name]);
// various links
$transactionsUri = route('accounts.reconcile.transactions', [$account->id, '%start%', '%end%']);
@@ -180,7 +180,7 @@ class ReconcileController extends Controller
if (TransactionType::RECONCILIATION !== $journal->transactionType->type) {
return redirect(route('transactions.show', [$journal->id]));
}
$subTitle = trans('firefly.reconciliation') . ' "' . $journal->description . '"';
$subTitle = (string)trans('firefly.reconciliation') . ' "' . $journal->description . '"';
// get main transaction:
$transaction = $this->repository->getAssetTransaction($journal);
@@ -272,7 +272,7 @@ class ReconcileController extends Controller
}
Log::debug('End of routine.');
app('preferences')->mark();
session()->flash('success', trans('firefly.reconciliation_stored'));
session()->flash('success', (string)trans('firefly.reconciliation_stored'));
return redirect(route('accounts.show', [$account->id]));
}
@@ -293,7 +293,7 @@ class ReconcileController extends Controller
return redirect(route('transactions.show', [$journal->id]));
}
if (0 === bccomp('0', $request->get('amount'))) {
session()->flash('error', trans('firefly.amount_cannot_be_zero'));
session()->flash('error', (string)trans('firefly.amount_cannot_be_zero'));
return redirect(route('accounts.reconcile.edit', [$journal->id]))->withInput();
}

View File

@@ -61,7 +61,7 @@ class ShowController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts'));
app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -107,7 +107,7 @@ class ShowController extends Controller
}
$fStart = $start->formatLocalized($this->monthAndDayFormat);
$fEnd = $end->formatLocalized($this->monthAndDayFormat);
$subTitle = trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
$subTitle = (string)trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
$periods = $this->getPeriodOverview($account, $end);
/** @var JournalCollectorInterface $collector */
@@ -151,7 +151,7 @@ class ShowController extends Controller
if (0 === $currencyId) {
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
}
$subTitle = trans('firefly.all_journals_for_account', ['name' => $account->name]);
$subTitle = (string)trans('firefly.all_journals_for_account', ['name' => $account->name]);
$periods = new Collection;
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);