Some translations and a new test.

This commit is contained in:
James Cole 2015-05-25 21:17:36 +02:00
parent afbca4ae65
commit 8bbf319032
5 changed files with 40 additions and 13 deletions

View File

@ -180,7 +180,10 @@ class BudgetController extends Controller
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->startOfMonth()); $end = Session::get('end', Carbon::now()->startOfMonth());
$list = $repository->getWithoutBudget($start, $end); $list = $repository->getWithoutBudget($start, $end);
$subTitle = 'Transactions without a budget between ' . $start->format('jS F Y') . ' and ' . $end->format('jS F Y'); $subTitle = trans(
'firefly.without_budget_between',
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
return view('budgets.noBudget', compact('list', 'subTitle')); return view('budgets.noBudget', compact('list', 'subTitle'));
} }
@ -214,7 +217,10 @@ class BudgetController extends Controller
$journals = $repository->getJournals($budget, $repetition); $journals = $repository->getJournals($budget, $repetition);
$limits = !is_null($repetition->id) ? [$repetition->budgetLimit] : $repository->getBudgetLimits($budget); $limits = !is_null($repetition->id) ? [$repetition->budgetLimit] : $repository->getBudgetLimits($budget);
$subTitle = !is_null($repetition->id) ? e($budget->name) . ' in ' . $repetition->startdate->format('F Y') : e($budget->name); $subTitle = !is_null($repetition->id) ?
trans('firefly.budget_in_month', ['name' => $budget->name, 'month' => $repetition->startdate->formatLocalized($this->monthFormat)])
:
e($budget->name);
$journals->setPath('/budgets/show/' . $budget->id); $journals->setPath('/budgets/show/' . $budget->id);
return view('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle')); return view('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle'));

View File

@ -261,18 +261,20 @@ class Navigation
public function periodShow(Carbon $date, $repeatFrequency) public function periodShow(Carbon $date, $repeatFrequency)
{ {
$formatMap = [ $formatMap = [
'daily' => 'j F Y', 'daily' => '%e %B %Y',
'week' => '\W\e\e\k W, Y', 'week' => 'Week %W, %Y',
'weekly' => '\W\e\e\k W, Y', 'weekly' => 'Week %W, %Y',
'quarter' => 'F Y', 'quarter' => '%B %Y',
'month' => 'F Y', 'month' => '%B %Y',
'monthly' => 'F Y', 'monthly' => '%B %Y',
'year' => 'Y', 'year' => '%Y',
'yearly' => 'Y', 'yearly' => '%Y',
]; ];
if (isset($formatMap[$repeatFrequency])) { if (isset($formatMap[$repeatFrequency])) {
return $date->format($formatMap[$repeatFrequency]); return $date->formatLocalized($formatMap[$repeatFrequency]);
} }
throw new FireflyException('No date formats for frequency "' . $repeatFrequency . '"!'); throw new FireflyException('No date formats for frequency "' . $repeatFrequency . '"!');
} }

View File

@ -31,6 +31,8 @@ return [
'transactionsWithoutBudgetDate' => 'Expenses without budget in :date', 'transactionsWithoutBudgetDate' => 'Expenses without budget in :date',
'createBudget' => 'New budget', 'createBudget' => 'New budget',
'inactiveBudgets' => 'Inactive budgets', 'inactiveBudgets' => 'Inactive budgets',
'without_budget_between' => 'Transactions without a budget between :start and :end',
'budget_in_month' => ':name in :month',
// accounts: // accounts:
'details_for_asset' => 'Details for asset account ":name"', 'details_for_asset' => 'Details for asset account ":name"',
@ -225,7 +227,7 @@ return [
'update_piggy_title' => 'Update piggy bank ":name"', 'update_piggy_title' => 'Update piggy bank ":name"',
'details' => 'Details', 'details' => 'Details',
'events' => 'Events', 'events' => 'Events',
'target_amount' => 'Target amount', 'target_amount' => 'Target amount',
'start_date' => 'Start date', 'start_date' => 'Start date',
'target_date' => 'Target date', 'target_date' => 'Target date',
'no_target_date' => 'No target date', 'no_target_date' => 'No target date',

View File

@ -31,6 +31,8 @@ return [
'transactionsWithoutBudgetDate' => 'Uitgaven zonder budget in :date', 'transactionsWithoutBudgetDate' => 'Uitgaven zonder budget in :date',
'createBudget' => 'Maak nieuw budget', 'createBudget' => 'Maak nieuw budget',
'inactiveBudgets' => 'Inactieve budgetten', 'inactiveBudgets' => 'Inactieve budgetten',
'without_budget_between' => 'Transacties zonder budget tussen :start en :end',
'budget_in_month' => ':name in :month',
// accounts: // accounts:
'details_for_asset' => 'Overzicht voor betaalrekening ":name"', 'details_for_asset' => 'Overzicht voor betaalrekening ":name"',
@ -234,7 +236,7 @@ return [
'update_piggy_title' => 'Wijzig spaarpotje ":name"', 'update_piggy_title' => 'Wijzig spaarpotje ":name"',
'details' => 'Details', 'details' => 'Details',
'events' => 'Gebeurtenissen', 'events' => 'Gebeurtenissen',
'target_amount' => 'Doelbedrag', 'target_amount' => 'Doelbedrag',
'start_date' => 'Startdatum', 'start_date' => 'Startdatum',
'target_date' => 'Doeldatum', 'target_date' => 'Doeldatum',
'no_target_date' => 'Geen doeldatum', 'no_target_date' => 'Geen doeldatum',

View File

@ -142,6 +142,21 @@ class TagRepositoryTest extends TestCase
} }
/**
* @covers FireflyIII\Repositories\Tag\TagRepository::connect
*/
public function testConnectInvalidType()
{
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$tag = FactoryMuffin::create('FireflyIII\Models\Tag');
$tag->tagMode = 'Idontknow';
$tag->save();
$result = $this->object->connect($journal, $tag);
$this->assertFalse($result);
}
/** /**
* Once one or more journals have been accepted by the tag, others must match the asset account * Once one or more journals have been accepted by the tag, others must match the asset account
* id. For this to work, we must also create an asset account, and a transaction. * id. For this to work, we must also create an asset account, and a transaction.