Skip to content

Firefly III: a personal finances manager

Some translations and a new test.

James Cole8bbf319032e0
diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php
index bd9364310d..82e6cc3208 100644
--- a/app/Http/Controllers/BudgetController.php
+++ b/app/Http/Controllers/BudgetController.php
@@ -180,7 +180,10 @@ class BudgetController extends Controller
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->startOfMonth());
$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'));
}
@@ -214,7 +217,10 @@ class BudgetController extends Controller
$journals = $repository->getJournals($budget, $repetition);
$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);
return view('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle'));
diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php
index b9dd7a652a..bfb3c607a2 100644
--- a/app/Support/Navigation.php
+++ b/app/Support/Navigation.php
@@ -261,18 +261,20 @@ class Navigation
public function periodShow(Carbon $date, $repeatFrequency)
{
$formatMap = [
- 'daily' => 'j F Y',
- 'week' => '\W\e\e\k W, Y',
- 'weekly' => '\W\e\e\k W, Y',
- 'quarter' => 'F Y',
- 'month' => 'F Y',
- 'monthly' => 'F Y',
- 'year' => 'Y',
- 'yearly' => 'Y',
+ 'daily' => '%e %B %Y',
+ 'week' => 'Week %W, %Y',
+ 'weekly' => 'Week %W, %Y',
+ 'quarter' => '%B %Y',
+ 'month' => '%B %Y',
+ 'monthly' => '%B %Y',
+ 'year' => '%Y',
+ 'yearly' => '%Y',
];
+
+
if (isset($formatMap[$repeatFrequency])) {
- return $date->format($formatMap[$repeatFrequency]);
+ return $date->formatLocalized($formatMap[$repeatFrequency]);
}
throw new FireflyException('No date formats for frequency "' . $repeatFrequency . '"!');
}
diff --git a/resources/lang/en/firefly.php b/resources/lang/en/firefly.php
index 5e62e516a4..6c5b1db772 100644
--- a/resources/lang/en/firefly.php
+++ b/resources/lang/en/firefly.php
@@ -31,6 +31,8 @@ return [
'transactionsWithoutBudgetDate' => 'Expenses without budget in :date',
'createBudget' => 'New budget',
'inactiveBudgets' => 'Inactive budgets',
+ 'without_budget_between' => 'Transactions without a budget between :start and :end',
+ 'budget_in_month' => ':name in :month',
// accounts:
'details_for_asset' => 'Details for asset account ":name"',
@@ -225,7 +227,7 @@ return [
'update_piggy_title' => 'Update piggy bank ":name"',
'details' => 'Details',
'events' => 'Events',
- 'target_amount' => 'Target amount',
+ 'target_amount' => 'Target amount',
'start_date' => 'Start date',
'target_date' => 'Target date',
'no_target_date' => 'No target date',
diff --git a/resources/lang/nl/firefly.php b/resources/lang/nl/firefly.php
index 0da0341aee..3aec9fb231 100644
--- a/resources/lang/nl/firefly.php
+++ b/resources/lang/nl/firefly.php
@@ -31,6 +31,8 @@ return [
'transactionsWithoutBudgetDate' => 'Uitgaven zonder budget in :date',
'createBudget' => 'Maak nieuw budget',
'inactiveBudgets' => 'Inactieve budgetten',
+ 'without_budget_between' => 'Transacties zonder budget tussen :start en :end',
+ 'budget_in_month' => ':name in :month',
// accounts:
'details_for_asset' => 'Overzicht voor betaalrekening ":name"',
@@ -234,7 +236,7 @@ return [
'update_piggy_title' => 'Wijzig spaarpotje ":name"',
'details' => 'Details',
'events' => 'Gebeurtenissen',
- 'target_amount' => 'Doelbedrag',
+ 'target_amount' => 'Doelbedrag',
'start_date' => 'Startdatum',
'target_date' => 'Doeldatum',
'no_target_date' => 'Geen doeldatum',
diff --git a/tests/repositories/TagRepositoryTest.php b/tests/repositories/TagRepositoryTest.php
index a1dbfc0bcb..9dcb52145d 100644
--- a/tests/repositories/TagRepositoryTest.php
+++ b/tests/repositories/TagRepositoryTest.php
@@ -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
* id. For this to work, we must also create an asset account, and a transaction.