Updates for translations.

This commit is contained in:
James Cole
2016-10-29 07:44:46 +02:00
parent 28eb54dc96
commit 73f1491d2d
28 changed files with 247 additions and 92 deletions

View File

@@ -46,8 +46,16 @@ class AccountController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('mainTitleIcon', 'fa-credit-card');
View::share('title', trans('firefly.accounts')); // translations:
$this->middleware(
function ($request, $next) {
View::share('mainTitleIcon', 'fa-credit-card');
View::share('title', trans('firefly.accounts'));
return $next($request);
}
);
} }
/** /**

View File

@@ -37,8 +37,15 @@ class ConfigurationController extends Controller
{ {
parent::__construct(); parent::__construct();
View::share('title', strval(trans('firefly.administration')));
View::share('mainTitleIcon', 'fa-hand-spock-o'); $this->middleware(
function ($request, $next) {
View::share('title', strval(trans('firefly.administration')));
View::share('mainTitleIcon', 'fa-hand-spock-o');
return $next($request);
}
);
} }

View File

@@ -42,8 +42,16 @@ class AttachmentController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('mainTitleIcon', 'fa-paperclip');
View::share('title', trans('firefly.attachments')); // translations:
$this->middleware(
function ($request, $next) {
View::share('mainTitleIcon', 'fa-paperclip');
View::share('title', trans('firefly.attachments'));
return $next($request);
}
);
} }
/** /**

View File

@@ -38,8 +38,16 @@ class BillController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.bills'));
View::share('mainTitleIcon', 'fa-calendar-o');
$this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.bills'));
View::share('mainTitleIcon', 'fa-calendar-o');
return $next($request);
}
);
} }
/** /**
@@ -140,7 +148,7 @@ class BillController extends Controller
// paid in this period? // paid in this period?
$bill->paidDates = $repository->getPaidDatesInRange($bill, $start, $end); $bill->paidDates = $repository->getPaidDatesInRange($bill, $start, $end);
$bill->payDates = $repository->getPayDatesInRange($bill, $start, $end); $bill->payDates = $repository->getPayDatesInRange($bill, $start, $end);
$lastDate = clone $start; $lastDate = clone $start;
if ($bill->paidDates->count() >= $bill->payDates->count()) { if ($bill->paidDates->count() >= $bill->payDates->count()) {
$lastDate = $end; $lastDate = $end;

View File

@@ -47,9 +47,17 @@ class BudgetController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.budgets'));
View::share('mainTitleIcon', 'fa-tasks');
View::share('hideBudgets', true); View::share('hideBudgets', true);
$this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.budgets'));
View::share('mainTitleIcon', 'fa-tasks');
return $next($request);
}
);
} }
/** /**
@@ -359,8 +367,8 @@ class BudgetController extends Controller
*/ */
public function store(BudgetFormRequest $request, BudgetRepositoryInterface $repository) public function store(BudgetFormRequest $request, BudgetRepositoryInterface $repository)
{ {
$data = $request->getBudgetData(); $data = $request->getBudgetData();
$budget = $repository->store($data); $budget = $repository->store($data);
Session::flash('success', strval(trans('firefly.stored_new_budget', ['name' => e($budget->name)]))); Session::flash('success', strval(trans('firefly.stored_new_budget', ['name' => e($budget->name)])));
Preferences::mark(); Preferences::mark();

View File

@@ -43,8 +43,16 @@ class CategoryController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.categories'));
View::share('mainTitleIcon', 'fa-bar-chart');
$this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.categories'));
View::share('mainTitleIcon', 'fa-bar-chart');
return $next($request);
}
);
} }
/** /**

View File

@@ -46,10 +46,18 @@ class Controller extends BaseController
View::share('hideBills', false); View::share('hideBills', false);
View::share('hideTags', false); View::share('hideTags', false);
// save some formats:
$this->monthFormat = (string)trans('config.month'); // translations:
$this->monthAndDayFormat = (string)trans('config.month_and_day');
$this->dateTimeFormat = (string)trans('config.date_time'); $this->middleware(
function ($request, $next) {
$this->monthFormat = (string)trans('config.month');
$this->monthAndDayFormat = (string)trans('config.month_and_day');
$this->dateTimeFormat = (string)trans('config.date_time');
return $next($request);
}
);
} }

View File

@@ -39,8 +39,16 @@ class CurrencyController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.currencies'));
View::share('mainTitleIcon', 'fa-usd');
$this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.currencies'));
View::share('mainTitleIcon', 'fa-usd');
return $next($request);
}
);
} }
/** /**

View File

@@ -41,8 +41,16 @@ class ExportController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('mainTitleIcon', 'fa-file-archive-o');
View::share('title', trans('firefly.export_data'));
$this->middleware(
function ($request, $next) {
View::share('mainTitleIcon', 'fa-file-archive-o');
View::share('title', trans('firefly.export_data'));
return $next($request);
}
);
} }
/** /**

View File

@@ -26,7 +26,7 @@ use Log;
use Preferences; use Preferences;
use Route; use Route;
use Session; use Session;
use View;
/** /**
* Class HomeController * Class HomeController
@@ -41,6 +41,8 @@ class HomeController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', 'Firefly III');
View::share('mainTitleIcon', 'fa-fire');
} }
/** /**
@@ -128,11 +130,9 @@ class HomeController extends Controller
return redirect(route('new-user.index')); return redirect(route('new-user.index'));
} }
$title = 'Firefly'; $subTitle = trans('firefly.welcomeBack');
$subTitle = trans('firefly.welcomeBack'); $transactions = [];
$mainTitleIcon = 'fa-fire'; $frontPage = Preferences::get(
$transactions = [];
$frontPage = Preferences::get(
'frontPageAccounts', $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray() 'frontPageAccounts', $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray()
); );
/** @var Carbon $start */ /** @var Carbon $start */
@@ -166,7 +166,7 @@ class HomeController extends Controller
// these routes are not relevant for the help pages: // these routes are not relevant for the help pages:
$ignore = ['login', 'registe', 'logout', 'two-fac', 'lost-two', 'confirm', 'resend', 'do_confirm', 'testFla', 'json.', 'piggy-banks.add', $ignore = ['login', 'registe', 'logout', 'two-fac', 'lost-two', 'confirm', 'resend', 'do_confirm', 'testFla', 'json.', 'piggy-banks.add',
'piggy-banks.remove', 'preferences.', 'rules.rule.up', 'rules.rule.down', 'rules.rule-group.up', 'rules.rule-group.down', 'popup.report', 'piggy-banks.remove', 'preferences.', 'rules.rule.up', 'rules.rule.down', 'rules.rule-group.up', 'rules.rule-group.down', 'popup.report',
'admin.users.domains.block-','import.json','help.' 'admin.users.domains.block-', 'import.json', 'help.',
]; ];
$routes = Route::getRoutes(); $routes = Route::getRoutes();
@@ -178,7 +178,7 @@ class HomeController extends Controller
$methods = $route->getMethods(); $methods = $route->getMethods();
if (!is_null($name) && strlen($name) > 0 && in_array('GET', $methods) && !$this->startsWithAny($ignore, $name)) { if (!is_null($name) && strlen($name) > 0 && in_array('GET', $methods) && !$this->startsWithAny($ignore, $name)) {
echo sprintf('touch %s.md', $name)."\n"; echo sprintf('touch %s.md', $name) . "\n";
} }
} }

View File

@@ -41,8 +41,15 @@ class ImportController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('mainTitleIcon', 'fa-archive');
View::share('title', trans('firefly.import_data_full')); $this->middleware(
function ($request, $next) {
View::share('mainTitleIcon', 'fa-archive');
View::share('title', trans('firefly.import_data_full'));
return $next($request);
}
);
} }
/** /**

View File

@@ -32,6 +32,13 @@ class NewUserController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->middleware(
function ($request, $next) {
return $next($request);
}
);
} }

View File

@@ -45,8 +45,16 @@ class PiggyBankController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.piggyBanks'));
View::share('mainTitleIcon', 'fa-sort-amount-asc');
$this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.piggyBanks'));
View::share('mainTitleIcon', 'fa-sort-amount-asc');
return $next($request);
}
);
} }
/** /**
@@ -364,7 +372,7 @@ class PiggyBankController extends Controller
*/ */
public function store(PiggyBankFormRequest $request, PiggyBankRepositoryInterface $repository) public function store(PiggyBankFormRequest $request, PiggyBankRepositoryInterface $repository)
{ {
$data = $request->getPiggyBankData(); $data = $request->getPiggyBankData();
$piggyBank = $repository->store($data); $piggyBank = $repository->store($data);
Session::flash('success', strval(trans('firefly.stored_piggy_bank', ['name' => e($piggyBank->name)]))); Session::flash('success', strval(trans('firefly.stored_piggy_bank', ['name' => e($piggyBank->name)])));
@@ -390,7 +398,7 @@ class PiggyBankController extends Controller
*/ */
public function update(PiggyBankRepositoryInterface $repository, PiggyBankFormRequest $request, PiggyBank $piggyBank) public function update(PiggyBankRepositoryInterface $repository, PiggyBankFormRequest $request, PiggyBank $piggyBank)
{ {
$data = $request->getPiggyBankData(); $data = $request->getPiggyBankData();
$piggyBank = $repository->update($piggyBank, $data); $piggyBank = $repository->update($piggyBank, $data);
Session::flash('success', strval(trans('firefly.updated_piggy_bank', ['name' => e($piggyBank->name)]))); Session::flash('success', strval(trans('firefly.updated_piggy_bank', ['name' => e($piggyBank->name)])));

View File

@@ -35,8 +35,16 @@ class PreferencesController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.preferences'));
View::share('mainTitleIcon', 'fa-gear');
$this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.preferences'));
View::share('mainTitleIcon', 'fa-gear');
return $next($request);
}
);
} }
/** /**

View File

@@ -36,8 +36,15 @@ class ProfileController extends Controller
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.profile'));
View::share('mainTitleIcon', 'fa-user'); $this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.profile'));
View::share('mainTitleIcon', 'fa-user');
return $next($request);
}
);
} }
/** /**
@@ -45,9 +52,11 @@ class ProfileController extends Controller
*/ */
public function changePassword() public function changePassword()
{ {
return view('profile.change-password')->with('title', auth()->user()->email)->with('subTitle', trans('firefly.change_your_password'))->with( $title = auth()->user()->email;
'mainTitleIcon', 'fa-user' $subTitle = strval(trans('firefly.change_your_password'));
); $subTitleIcon = 'fa-key';
return view('profile.change-password', compact('title', 'subTitle', 'subTitleIcon'));
} }
/** /**
@@ -55,9 +64,11 @@ class ProfileController extends Controller
*/ */
public function deleteAccount() public function deleteAccount()
{ {
return view('profile.delete-account')->with('title', auth()->user()->email)->with('subTitle', trans('firefly.delete_account'))->with( $title = auth()->user()->email;
'mainTitleIcon', 'fa-user' $subTitle = strval(trans('firefly.delete_account'));
); $subTitleIcon = 'fa-trash';
return view('profile.delete-account', compact('title', 'subTitle', 'subTitleIcon'));
} }
/** /**

View File

@@ -53,6 +53,7 @@ class AccountController extends Controller
$result = view('reports.partials.accounts', compact('accountReport'))->render(); $result = view('reports.partials.accounts', compact('accountReport'))->render();
$cache->store($result); $cache->store($result);
return $result; return $result;
} }
} }

View File

@@ -49,8 +49,18 @@ class ReportController extends Controller
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.reports'));
View::share('mainTitleIcon', 'fa-line-chart'); $this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.reports'));
View::share('mainTitleIcon', 'fa-line-chart');
$this->helper = app(ReportHelperInterface::class);
$this->budgetHelper = app(BudgetReportHelperInterface::class);
return $next($request);
}
);
} }
@@ -61,7 +71,7 @@ class ReportController extends Controller
*/ */
public function index(AccountRepositoryInterface $repository) public function index(AccountRepositoryInterface $repository)
{ {
$this->createRepositories();
/** @var Carbon $start */ /** @var Carbon $start */
$start = clone session('first'); $start = clone session('first');
$months = $this->helper->listOfMonths($start); $months = $this->helper->listOfMonths($start);
@@ -92,7 +102,6 @@ class ReportController extends Controller
*/ */
public function report(string $reportType, Carbon $start, Carbon $end, Collection $accounts) public function report(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
{ {
$this->createRepositories();
// throw an error if necessary. // throw an error if necessary.
if ($end < $start) { if ($end < $start) {
throw new FireflyException('End date cannot be before start date, silly!'); throw new FireflyException('End date cannot be before start date, silly!');
@@ -200,15 +209,6 @@ class ReportController extends Controller
return view('reports.audit.report', compact('start', 'end', 'reportType', 'accountIds', 'accounts', 'auditData', 'hideable', 'defaultShow')); return view('reports.audit.report', compact('start', 'end', 'reportType', 'accountIds', 'accounts', 'auditData', 'hideable', 'defaultShow'));
} }
/**
*
*/
private function createRepositories()
{
$this->helper = app(ReportHelperInterface::class);
$this->budgetHelper = app(BudgetReportHelperInterface::class);
}
/** /**
* @param $reportType * @param $reportType
* @param Carbon $start * @param Carbon $start

View File

@@ -42,8 +42,16 @@ class RuleController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.rules'));
View::share('mainTitleIcon', 'fa-random');
$this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.rules'));
View::share('mainTitleIcon', 'fa-random');
return $next($request);
}
);
} }
/** /**

View File

@@ -41,8 +41,16 @@ class RuleGroupController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.rules'));
View::share('mainTitleIcon', 'fa-random');
$this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.rules'));
View::share('mainTitleIcon', 'fa-random');
return $next($request);
}
);
} }
/** /**
@@ -204,8 +212,8 @@ class RuleGroupController extends Controller
*/ */
public function store(RuleGroupFormRequest $request, RuleGroupRepositoryInterface $repository) public function store(RuleGroupFormRequest $request, RuleGroupRepositoryInterface $repository)
{ {
$data = $request->getRuleGroupData(); $data = $request->getRuleGroupData();
$ruleGroup = $repository->store($data); $ruleGroup = $repository->store($data);
Session::flash('success', strval(trans('firefly.created_new_rule_group', ['title' => $ruleGroup->title]))); Session::flash('success', strval(trans('firefly.created_new_rule_group', ['title' => $ruleGroup->title])));
Preferences::mark(); Preferences::mark();

View File

@@ -29,6 +29,13 @@ class SearchController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->middleware(
function ($request, $next) {
return $next($request);
}
);
} }
/** /**

View File

@@ -50,15 +50,22 @@ class TagController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', 'Tags');
View::share('mainTitleIcon', 'fa-tags');
View::share('hideTags', true); View::share('hideTags', true);
$this->tagOptions = [
'nothing' => trans('firefly.regular_tag'), $this->middleware(
'balancingAct' => trans('firefly.balancing_act'), function ($request, $next) {
'advancePayment' => trans('firefly.advance_payment'), View::share('title', 'Tags');
]; View::share('mainTitleIcon', 'fa-tags');
View::share('tagOptions', $this->tagOptions); $this->tagOptions = [
'nothing' => trans('firefly.regular_tag'),
'balancingAct' => trans('firefly.balancing_act'),
'advancePayment' => trans('firefly.advance_payment'),
];
View::share('tagOptions', $this->tagOptions);
return $next($request);
}
);
} }
/** /**

View File

@@ -41,8 +41,16 @@ class MassController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.transactions'));
View::share('mainTitleIcon', 'fa-repeat');
$this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.transactions'));
View::share('mainTitleIcon', 'fa-repeat');
return $next($request);
}
);
} }
/** /**

View File

@@ -59,8 +59,6 @@ class SingleController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.transactions'));
View::share('mainTitleIcon', 'fa-repeat');
$maxFileSize = Steam::phpBytes(ini_get('upload_max_filesize')); $maxFileSize = Steam::phpBytes(ini_get('upload_max_filesize'));
$maxPostSize = Steam::phpBytes(ini_get('post_max_size')); $maxPostSize = Steam::phpBytes(ini_get('post_max_size'));
@@ -75,11 +73,13 @@ class SingleController extends Controller
$this->piggyBanks = app(PiggyBankRepositoryInterface::class); $this->piggyBanks = app(PiggyBankRepositoryInterface::class);
$this->attachments = app(AttachmentHelperInterface::class); $this->attachments = app(AttachmentHelperInterface::class);
View::share('title', trans('firefly.transactions'));
View::share('mainTitleIcon', 'fa-repeat');
return $next($request); return $next($request);
} }
); );
} }
/** /**

View File

@@ -63,8 +63,7 @@ class SplitController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('mainTitleIcon', 'fa-share-alt');
View::share('title', trans('firefly.split-transactions'));
// some useful repositories: // some useful repositories:
$this->middleware( $this->middleware(
@@ -74,6 +73,8 @@ class SplitController extends Controller
$this->tasker = app(JournalTaskerInterface::class); $this->tasker = app(JournalTaskerInterface::class);
$this->attachments = app(AttachmentHelperInterface::class); $this->attachments = app(AttachmentHelperInterface::class);
$this->currencies = app(CurrencyRepositoryInterface::class); $this->currencies = app(CurrencyRepositoryInterface::class);
View::share('mainTitleIcon', 'fa-share-alt');
View::share('title', trans('firefly.split-transactions'));
return $next($request); return $next($request);
} }

View File

@@ -35,8 +35,16 @@ class TransactionController extends Controller
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
View::share('title', trans('firefly.transactions'));
View::share('mainTitleIcon', 'fa-repeat');
$this->middleware(
function ($request, $next) {
View::share('title', trans('firefly.transactions'));
View::share('mainTitleIcon', 'fa-repeat');
return $next($request);
}
);
} }

View File

@@ -619,7 +619,6 @@ return [
'more_info_help' => 'More information about these types of reports can be found in the help pages. Press the (?) icon in the top right corner.', 'more_info_help' => 'More information about these types of reports can be found in the help pages. Press the (?) icon in the top right corner.',
'report_included_accounts' => 'Included accounts', 'report_included_accounts' => 'Included accounts',
'report_date_range' => 'Date range', 'report_date_range' => 'Date range',
'report_include_help' => 'In all cases, transfers to shared accounts count as expenses, and transfers from shared accounts count as income.',
'report_preset_ranges' => 'Pre-set ranges', 'report_preset_ranges' => 'Pre-set ranges',
'shared' => 'Shared', 'shared' => 'Shared',
'fiscal_year' => 'Fiscal year', 'fiscal_year' => 'Fiscal year',

View File

@@ -4,13 +4,12 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="robots" content="noindex, nofolllow, noarchive, noodp, NoImageIndex, noydir"> <meta name="robots" content="noindex, nofolllow, noarchive, noodp, NoImageIndex, noydir">
<title>Firefly <title>Firefly III
{% if title != "Firefly" %} {% if title != "Firefly III" %}
// {{ title }} » {{ title }}
{% endif %} {% endif %}
{% if subTitle %} {% if subTitle %}
// {{ subTitle }} » {{ subTitle }}
{% endif %} {% endif %}
</title> </title>
<base href="{{ route('index') }}/"> <base href="{{ route('index') }}/">

View File

@@ -45,9 +45,6 @@
</div> </div>
{% endfor %} {% endfor %}
<p class="help-block">
{{ 'report_include_help'|_ }}
</p>
</div> </div>
</div> </div>