diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php index c4d042b13e..066ee64665 100644 --- a/app/Providers/FireflyServiceProvider.php +++ b/app/Providers/FireflyServiceProvider.php @@ -10,6 +10,7 @@ use FireflyIII\Support\Preferences; use FireflyIII\Support\Steam; use FireflyIII\Support\Twig\Budget; use FireflyIII\Support\Twig\General; +use FireflyIII\Support\Twig\Translation; use FireflyIII\Support\Twig\Journal; use FireflyIII\Support\Twig\PiggyBank; use FireflyIII\Validation\FireflyValidator; @@ -42,6 +43,7 @@ class FireflyServiceProvider extends ServiceProvider Twig::addExtension(new General); Twig::addExtension(new Journal); Twig::addExtension(new Budget); + Twig::addExtension(new Translation); } public function register() diff --git a/app/Support/Twig/Translation.php b/app/Support/Twig/Translation.php new file mode 100644 index 0000000000..3bfd795420 --- /dev/null +++ b/app/Support/Twig/Translation.php @@ -0,0 +1,42 @@ + ['html']] + ); + + return $filters; + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return 'FireflyIII\Support\Twig\Translation'; + } +} diff --git a/resources/lang/en/firefly.php b/resources/lang/en/firefly.php index 461513be1b..7053e27f94 100644 --- a/resources/lang/en/firefly.php +++ b/resources/lang/en/firefly.php @@ -6,5 +6,7 @@ return [ 'pleaseHold' => 'Please hold...', 'mandatoryFields' => 'Mandatory fields', 'optionalFields' => 'Optional fields', - 'options' => 'Options' + 'options' => 'Options', + 'something' => 'Something!' + ]; diff --git a/resources/twig/accounts/create.twig b/resources/twig/accounts/create.twig index 4e50f1dfbb..1a11d72452 100644 --- a/resources/twig/accounts/create.twig +++ b/resources/twig/accounts/create.twig @@ -9,7 +9,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.text('name') }} @@ -22,7 +22,7 @@ {% if what == 'asset' %}
- {{ trans('firefly.optionalFields') }} + {{ 'optionalFields'|_ }}
@@ -37,7 +37,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('create','account') }} diff --git a/resources/twig/accounts/edit.twig b/resources/twig/accounts/edit.twig index 0bfe9e258b..f32d375941 100644 --- a/resources/twig/accounts/edit.twig +++ b/resources/twig/accounts/edit.twig @@ -9,7 +9,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.text('name') }} @@ -20,7 +20,7 @@
- {{ trans('firefly.optionalFields') }} + {{ 'optionalFields'|_ }}
{% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %} @@ -50,7 +50,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('update','account') }} diff --git a/resources/twig/bills/create.twig b/resources/twig/bills/create.twig index cd6938771b..50e87921ca 100644 --- a/resources/twig/bills/create.twig +++ b/resources/twig/bills/create.twig @@ -7,7 +7,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.text('name') }} @@ -23,7 +23,7 @@
- {{ trans('firefly.optionalFields') }} + {{ 'optionalFields'|_ }}
{{ ExpandedForm.integer('skip',0) }} @@ -35,7 +35,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('create','bill') }} diff --git a/resources/twig/bills/edit.twig b/resources/twig/bills/edit.twig index 9eb5f05892..0e96f79885 100644 --- a/resources/twig/bills/edit.twig +++ b/resources/twig/bills/edit.twig @@ -9,7 +9,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.text('name') }} @@ -26,7 +26,7 @@
- {{ trans('firefly.optionalFields') }} + {{ 'optionalFields'|_ }}
{{ ExpandedForm.integer('skip') }} @@ -37,7 +37,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('update','bill') }} diff --git a/resources/twig/budgets/create.twig b/resources/twig/budgets/create.twig index ee5c2b338e..526bc9d00e 100644 --- a/resources/twig/budgets/create.twig +++ b/resources/twig/budgets/create.twig @@ -6,7 +6,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.text('name') }} @@ -17,7 +17,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('create','budget') }} diff --git a/resources/twig/budgets/edit.twig b/resources/twig/budgets/edit.twig index cdb62233b9..9818ea25a0 100644 --- a/resources/twig/budgets/edit.twig +++ b/resources/twig/budgets/edit.twig @@ -13,7 +13,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.checkbox('active') }} @@ -26,7 +26,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('update','budget') }} diff --git a/resources/twig/categories/create.twig b/resources/twig/categories/create.twig index 3ae6089566..58b44c976c 100644 --- a/resources/twig/categories/create.twig +++ b/resources/twig/categories/create.twig @@ -7,7 +7,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.text('name') }} @@ -20,7 +20,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('create','category') }} diff --git a/resources/twig/categories/edit.twig b/resources/twig/categories/edit.twig index 5c1f623685..446e51faf5 100644 --- a/resources/twig/categories/edit.twig +++ b/resources/twig/categories/edit.twig @@ -7,7 +7,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.text('name') }} @@ -21,7 +21,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('update','category') }} diff --git a/resources/twig/currency/create.twig b/resources/twig/currency/create.twig index 01cc6c131e..2b667d69a2 100644 --- a/resources/twig/currency/create.twig +++ b/resources/twig/currency/create.twig @@ -6,7 +6,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.text('name',null,{'maxlength' : 48}) }} @@ -22,7 +22,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('create','currency') }} diff --git a/resources/twig/currency/edit.twig b/resources/twig/currency/edit.twig index dc4720d1f6..172c3ce408 100644 --- a/resources/twig/currency/edit.twig +++ b/resources/twig/currency/edit.twig @@ -8,7 +8,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.text('name',null,{'maxlength' : 48}) }} @@ -23,7 +23,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('update','currency') }} diff --git a/resources/twig/index.twig b/resources/twig/index.twig index 24097c2b09..36836b753b 100644 --- a/resources/twig/index.twig +++ b/resources/twig/index.twig @@ -5,7 +5,7 @@ {% if count == 0 %}
-

{{ trans('firefly.welcome') }}

+

{{ 'welcome'|_ }}

Create a new asset account to get started. diff --git a/resources/twig/layout/default.twig b/resources/twig/layout/default.twig index 2bf12e7cc0..149ecced8c 100644 --- a/resources/twig/layout/default.twig +++ b/resources/twig/layout/default.twig @@ -89,15 +89,15 @@

diff --git a/resources/twig/piggy-banks/create.twig b/resources/twig/piggy-banks/create.twig index 46214c5f2c..cf62c481e7 100644 --- a/resources/twig/piggy-banks/create.twig +++ b/resources/twig/piggy-banks/create.twig @@ -8,7 +8,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
@@ -22,7 +22,7 @@
- {{ trans('firefly.optionalFields') }} + {{ 'optionalFields'|_ }}
{{ ExpandedForm.date('targetdate') }} @@ -34,7 +34,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('create','piggy bank') }} diff --git a/resources/twig/piggy-banks/edit.twig b/resources/twig/piggy-banks/edit.twig index db6fa3eafb..6200bd7def 100644 --- a/resources/twig/piggy-banks/edit.twig +++ b/resources/twig/piggy-banks/edit.twig @@ -10,7 +10,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
@@ -25,7 +25,7 @@
- {{ trans('firefly.optionalFields') }} + {{ 'optionalFields'|_ }}
{{ ExpandedForm.date('targetdate') }} @@ -37,7 +37,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('update','piggy bank') }} diff --git a/resources/twig/tags/create.twig b/resources/twig/tags/create.twig index 36cc5e03d0..72cd43e642 100644 --- a/resources/twig/tags/create.twig +++ b/resources/twig/tags/create.twig @@ -7,7 +7,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.text('tag') }} @@ -20,7 +20,7 @@
- {{ trans('firefly.optionalFields') }} + {{ 'optionalFields'|_ }}
{{ ExpandedForm.date('date') }} @@ -32,7 +32,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('create','tag') }} diff --git a/resources/twig/tags/edit.twig b/resources/twig/tags/edit.twig index 2d92e75ba9..01fedc6eb7 100644 --- a/resources/twig/tags/edit.twig +++ b/resources/twig/tags/edit.twig @@ -9,7 +9,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
{{ ExpandedForm.text('tag') }} @@ -22,7 +22,7 @@
- {{ trans('firefly.optionalFields') }} + {{ 'optionalFields'|_ }}
{{ ExpandedForm.date('date') }} @@ -34,7 +34,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('update','tag') }} diff --git a/resources/twig/transactions/create.twig b/resources/twig/transactions/create.twig index f356aaf7c4..445c09c72d 100644 --- a/resources/twig/transactions/create.twig +++ b/resources/twig/transactions/create.twig @@ -8,7 +8,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
@@ -47,7 +47,7 @@
- {{ trans('firefly.optionalFields') }} + {{ 'optionalFields'|_ }}
@@ -71,7 +71,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('create','transaction') }} diff --git a/resources/twig/transactions/edit.twig b/resources/twig/transactions/edit.twig index 8f8587f42c..5ab00230f0 100644 --- a/resources/twig/transactions/edit.twig +++ b/resources/twig/transactions/edit.twig @@ -10,7 +10,7 @@
- {{ trans('firefly.mandatoryFields') }} + {{ 'mandatoryFields'|_ }}
@@ -49,7 +49,7 @@
- {{ trans('firefly.optionalFields') }} + {{ 'optionalFields'|_ }}
@@ -74,7 +74,7 @@
- {{ trans('firefly.options') }} + {{ 'options'|_ }}
{{ ExpandedForm.optionsList('update','transaction') }}