{{ 'invoice.to'|trans({}, 'messages', language) }}
+{{ 'invoice.to'|trans }}
{{ model.customer.company|default(model.customer.name) }}
{{ model.customer.address|nl2br }}
{% if model.customer.vatId is not empty %}
- {{ 'label.vat_id'|trans({}, 'messages', language) }}: {{ model.customer.vatId }}
+ {{ 'label.vat_id'|trans }}: {{ model.customer.vatId }}
{% endif %}
| {{ 'label.date'|trans({}, 'messages', language) }}: | +{{ 'label.date'|trans }}: | {{ model.invoiceDate|date_short }} | |||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ 'invoice.service_date'|trans({}, 'messages', language) }}: | -{{ model.query.end|month_name|trans({}, 'messages', language) }} {{ model.query.end|date('Y') }} | +{{ 'invoice.service_date'|trans }}: | +{{ model.query.end|month_name }} {{ model.query.end|date('Y') }} | ||||||||||||||||||||||||||||||||||||||||||||||||
| {{ 'invoice.number'|trans({}, 'messages', language) }}: | +{{ 'invoice.number'|trans }}: | {{ model.invoiceNumber }} | |||||||||||||||||||||||||||||||||||||||||||||||||
| {{ 'label.orderNumber'|trans({}, 'messages', language) }} | +{{ 'label.orderNumber'|trans }} | {{ model.query.project.orderNumber }} | @@ -48,7 +46,7 @@ {% endif %} {% if model.template.vatId is not empty %}|||||||||||||||||||||||||||||||||||||||||||||||||
| {{ 'label.vat_id'|trans({}, 'messages', language) }}: | +{{ 'label.vat_id'|trans }}: | {{ model.template.vatId }} | @@ -61,10 +59,10 @@
| {{ 'label.description'|trans({}, 'messages', language) }} | -{{ 'label.unit_price'|trans({}, 'messages', language) }} | -{{ 'label.amount'|trans({}, 'messages', language) }} | -{{ 'label.total_rate'|trans({}, 'messages', language) }} | +{{ 'label.description'|trans }} | +{{ 'label.unit_price'|trans }} | +{{ 'label.amount'|trans }} | +{{ 'label.total_rate'|trans }} |
|---|
| {{ 'invoice.subtotal'|trans({}, 'messages', language) }} | +{{ 'invoice.subtotal'|trans }} | {{ model.calculator.subtotal|money(currency) }} |
|---|---|---|
| {{ 'invoice.tax'|trans({}, 'messages', language) }} ({{ model.calculator.vat }}%) | +{{ 'invoice.tax'|trans }} ({{ model.calculator.vat }}%) | {{ model.calculator.tax|money(currency) }} |
| {{ 'invoice.total'|trans({}, 'messages', language) }} | +{{ 'invoice.total'|trans }} | {{ model.calculator.total|money(currency) }} |
- {{ 'label.address'|trans({}, 'messages', language) }} + {{ 'label.address'|trans }}
{{ model.template.company }}
@@ -127,7 +125,7 @@
- {{ 'label.invoice_bank_account'|trans({}, 'messages', language) }} + {{ 'label.invoice_bank_account'|trans }}
{{ model.template.paymentDetails|nl2br }} @@ -135,7 +133,7 @@
- {{ 'label.contact'|trans({}, 'messages', language) }} + {{ 'label.contact'|trans }}
{{ model.template.contact|nl2br }} diff --git a/templates/invoice/renderer/timesheet.html.twig b/templates/invoice/renderer/timesheet.html.twig index c1a3b3c5..62f9952c 100644 --- a/templates/invoice/renderer/timesheet.html.twig +++ b/templates/invoice/renderer/timesheet.html.twig @@ -1,10 +1,8 @@ {% import "macros/widgets.html.twig" as widgets %} {% extends 'invoice/layout.html.twig' %} -{% set fallback = app.request is not null ? app.request.locale : 'en' %} -{% set language = model.template.language|default(fallback) %} -{% set isDecimal = model.template.decimalDuration|default(false) %} {% block invoice %} +{% set isDecimal = model.template.decimalDuration|default(false) %}
@@ -17,7 +15,7 @@
- {{ 'invoice.from'|trans({}, 'messages', language) }}
+ {{ 'invoice.from'|trans }}
{% if model.query.user is not empty %}
{{ widgets.username(model.query.user) }}
@@ -27,17 +25,17 @@
- {{ 'label.date'|trans({}, 'messages', language) }}
+ {{ 'label.date'|trans }}
{% if model.query.begin|date('m') != model.query.end|date('m') or model.query.begin|date('Y') != model.query.end|date('Y') %}
{{ model.query.begin|date_short }} - {{ model.query.end|date_short }}
{% else %}
- {{ model.query.end|month_name|trans({}, 'messages', language) }} {{ model.query.end|date('Y') }}
+ {{ model.query.end|month_name }} {{ model.query.end|date('Y') }}
{% endif %}
- {{ 'label.customer'|trans({}, 'messages', language) }}
+ {{ 'label.customer'|trans }}
{% if model.customer.number is not empty %}[{{ model.customer.number }}]{% endif %}
{{ model.customer.name }}{% if model.customer.contact is not empty %} / {{ model.customer.contact }}{% endif %}
@@ -45,7 +43,7 @@
{% if model.query.project is not empty and model.query.project.orderNumber is not empty %}
- {{ 'label.orderNumber'|trans({}, 'messages', language) }}
+ {{ 'label.orderNumber'|trans }}
{{ model.query.project.orderNumber }}
@@ -60,12 +58,12 @@
- {{ 'label.date'|trans({}, 'messages', language) }}
+ {{ 'label.date'|trans }}
{% if model.query.user is empty %}
- {{ 'label.user'|trans({}, 'messages', language) }}
+ {{ 'label.user'|trans }}
{% endif %}
- {{ 'label.activity'|trans({}, 'messages', language) }}
- {{ 'label.hours'|trans({}, 'messages', language) }}
+ {{ 'label.activity'|trans }}
+ {{ 'label.hours'|trans }}
@@ -92,7 +90,7 @@
{% if model.query.user is empty %}
{% endif %}
- {{ 'invoice.total_working_time'|trans({}, 'messages', language) }}
+ {{ 'invoice.total_working_time'|trans }}
{{ model.calculator.timeWorked|duration(isDecimal) }}
@@ -103,7 +101,7 @@
{% if model.template.paymentTerms is not empty %}
- {{ 'label.payment_terms'|trans({}, 'messages', language) }}
+ {{ 'label.payment_terms'|trans }}
{{ model.template.paymentTerms|trim|nl2br }}
@@ -114,10 +112,10 @@
- {{ 'invoice.signature_user'|trans({}, 'messages', language) }}
+ {{ 'invoice.signature_user'|trans }}
- {{ 'invoice.signature_customer'|trans({}, 'messages', language) }}
+ {{ 'invoice.signature_customer'|trans }}
diff --git a/templates/user/layout.html.twig b/templates/user/layout.html.twig
index 20e7a5a2..5862c7a2 100644
--- a/templates/user/layout.html.twig
+++ b/templates/user/layout.html.twig
@@ -32,6 +32,7 @@
{% if seeOwnRate %}
{{ 'stats.amountMonth'|trans }}
+ {# TODO which currency shall we use here? #}
{{ stats.amountThisMonth|money }}
{% endif %}
@@ -42,6 +43,7 @@
{% if seeOwnRate %}
{{ 'stats.amountTotal'|trans }}
+ {# TODO which currency shall we use here? #}
{{ stats.amountTotal|money }}
{% endif %}
@@ -103,73 +105,3 @@
});
{% endblock %}
-
-
-{# -------------------------------- UNUSED FOR NOW -------------------------------- #}
-{% macro profile_list_unused(user, items) %}
- {% import "@AdminLTE/Macros/default.html.twig" as macro %}
- {% import "macros/widgets.html.twig" as widgets %}
-
-
-{% endmacro %}
-
-{# -------------------------------- UNUSED FOR NOW -------------------------------- #}
-{% macro profile_box_unused(user, stats) %}
- {% import "@AdminLTE/Macros/default.html.twig" as macro %}
- {% import "macros/widgets.html.twig" as widgets %}
-
-
-{% endmacro %}
\ No newline at end of file
diff --git a/templates/widget/widget-paginatedworkingtimechart.html.twig b/templates/widget/widget-paginatedworkingtimechart.html.twig
index b0201d1b..f5ebbb43 100644
--- a/templates/widget/widget-paginatedworkingtimechart.html.twig
+++ b/templates/widget/widget-paginatedworkingtimechart.html.twig
@@ -53,7 +53,7 @@
{{ data.month|duration }}
- {{ 'stats.workingTimeMonth'|trans({'%month%': data.begin|month_name|trans, '%year%': data.begin|date_format('Y')}) }}
+ {{ 'stats.workingTimeMonth'|trans({'%month%': data.begin|month_name, '%year%': data.begin|date_format('Y')}) }}
diff --git a/tests/Entity/TimesheetTest.php b/tests/Entity/TimesheetTest.php
index 8d6c2f07..697e91ec 100644
--- a/tests/Entity/TimesheetTest.php
+++ b/tests/Entity/TimesheetTest.php
@@ -28,6 +28,8 @@ class TimesheetTest extends TestCase
public function testDefaultValues()
{
$sut = new Timesheet();
+ self::assertEquals('timesheet', $sut->getType());
+ self::assertEquals('work', $sut->getCategory());
self::assertNull($sut->getId());
self::assertNull($sut->getBegin());
self::assertNull($sut->getEnd());
diff --git a/tests/Export/Renderer/AbstractRendererTest.php b/tests/Export/Renderer/AbstractRendererTest.php
index 3a11f396..af1a7fdc 100644
--- a/tests/Export/Renderer/AbstractRendererTest.php
+++ b/tests/Export/Renderer/AbstractRendererTest.php
@@ -29,7 +29,6 @@ use App\Export\ExportRendererInterface;
use App\Export\RendererInterface;
use App\Repository\Query\TimesheetQuery;
use App\Twig\DateExtensions;
-use App\Utils\LocaleSettings;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -60,10 +59,8 @@ abstract class AbstractRendererTest extends KernelTestCase
$request->setLocale('en');
$requestStack->push($request);
- $localeSettings = new LocaleSettings($requestStack, new LanguageFormattings($languages));
-
$translator = $this->createMock(TranslatorInterface::class);
- $dateExtension = new DateExtensions($localeSettings);
+ $dateExtension = new DateExtensions($requestStack, new LanguageFormattings($languages));
$dispatcher = new EventDispatcher();
$dispatcher->addSubscriber(new MetaFieldColumnSubscriber());
diff --git a/tests/Export/Timesheet/AbstractRendererTest.php b/tests/Export/Timesheet/AbstractRendererTest.php
index ccb29bea..53f788ca 100644
--- a/tests/Export/Timesheet/AbstractRendererTest.php
+++ b/tests/Export/Timesheet/AbstractRendererTest.php
@@ -28,7 +28,6 @@ use App\Event\TimesheetMetaDisplayEvent;
use App\Export\TimesheetExportInterface;
use App\Repository\Query\TimesheetQuery;
use App\Twig\DateExtensions;
-use App\Utils\LocaleSettings;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -59,10 +58,8 @@ abstract class AbstractRendererTest extends KernelTestCase
$request->setLocale('en');
$requestStack->push($request);
- $localeSettings = new LocaleSettings($requestStack, new LanguageFormattings($languages));
-
$translator = $this->getMockBuilder(TranslatorInterface::class)->getMock();
- $dateExtension = new DateExtensions($localeSettings);
+ $dateExtension = new DateExtensions($requestStack, new LanguageFormattings($languages));
$dispatcher = new EventDispatcher();
$dispatcher->addSubscriber(new MetaFieldColumnSubscriber());
diff --git a/tests/Invoice/DebugFormatter.php b/tests/Invoice/DebugFormatter.php
index 8ae04258..e66c5bc6 100644
--- a/tests/Invoice/DebugFormatter.php
+++ b/tests/Invoice/DebugFormatter.php
@@ -32,17 +32,22 @@ class DebugFormatter implements InvoiceFormatter
}
/**
- * @param mixed $amount
+ * @param int|float $amount
* @param string|null $currency
- * @return mixed
+ * @param bool $withCurrency
+ * @return string
*/
- public function getFormattedMoney($amount, $currency)
+ public function getFormattedMoney($amount, ?string $currency, bool $withCurrency = true)
{
- if (null !== $currency) {
+ if (null === $currency) {
+ $withCurrency = false;
+ }
+
+ if ($withCurrency) {
return $amount . ' ' . $currency;
}
- return $amount;
+ return (string) $amount;
}
/**
diff --git a/tests/Invoice/Renderer/JsonRendererTest.php b/tests/Invoice/Renderer/JsonRendererTest.php
index d91f37ac..c274f7f8 100644
--- a/tests/Invoice/Renderer/JsonRendererTest.php
+++ b/tests/Invoice/Renderer/JsonRendererTest.php
@@ -16,6 +16,7 @@ use Twig\Environment;
use Twig\Loader\FilesystemLoader;
/**
+ * @covers \App\Invoice\Renderer\AbstractTwigRenderer
* @covers \App\Invoice\Renderer\JsonRenderer
* @group integration
*/
diff --git a/tests/Invoice/Renderer/PdfRendererTest.php b/tests/Invoice/Renderer/PdfRendererTest.php
index fdca394b..aedcda31 100644
--- a/tests/Invoice/Renderer/PdfRendererTest.php
+++ b/tests/Invoice/Renderer/PdfRendererTest.php
@@ -17,6 +17,7 @@ use Twig\Environment;
use Twig\Loader\FilesystemLoader;
/**
+ * @covers \App\Invoice\Renderer\AbstractTwigRenderer
* @covers \App\Invoice\Renderer\PdfRenderer
* @group integration
*/
diff --git a/tests/Invoice/Renderer/RendererTestTrait.php b/tests/Invoice/Renderer/RendererTestTrait.php
index 45c52d79..cc628591 100644
--- a/tests/Invoice/Renderer/RendererTestTrait.php
+++ b/tests/Invoice/Renderer/RendererTestTrait.php
@@ -30,11 +30,9 @@ use App\Invoice\NumberGenerator\DateNumberGenerator;
use App\Invoice\Renderer\AbstractRenderer;
use App\Repository\Query\InvoiceQuery;
use App\Twig\DateExtensions;
-use App\Twig\Extensions;
-use App\Utils\LocaleSettings;
+use App\Twig\LocaleExtensions;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
-use Symfony\Contracts\Translation\TranslatorInterface;
trait RendererTestTrait
{
@@ -87,13 +85,12 @@ trait RendererTestTrait
$request->setLocale('en');
$requestStack->push($request);
- $localeSettings = new LocaleSettings($requestStack, new LanguageFormattings($languages));
+ $formattings = new LanguageFormattings($languages);
- $translator = $this->getMockBuilder(TranslatorInterface::class)->getMock();
- $dateExtension = new DateExtensions($localeSettings);
- $extensions = new Extensions($localeSettings);
+ $dateExtension = new DateExtensions($requestStack, $formattings);
+ $extensions = new LocaleExtensions($requestStack, $formattings);
- return new DefaultInvoiceFormatter($translator, $dateExtension, $extensions);
+ return new DefaultInvoiceFormatter($dateExtension, $extensions);
}
protected function getInvoiceModel(): InvoiceModel
diff --git a/tests/Invoice/Renderer/TextRendererTest.php b/tests/Invoice/Renderer/TextRendererTest.php
index 602eab14..477d1889 100644
--- a/tests/Invoice/Renderer/TextRendererTest.php
+++ b/tests/Invoice/Renderer/TextRendererTest.php
@@ -16,6 +16,7 @@ use Twig\Environment;
use Twig\Loader\FilesystemLoader;
/**
+ * @covers \App\Invoice\Renderer\AbstractTwigRenderer
* @covers \App\Invoice\Renderer\TextRenderer
* @group integration
*/
diff --git a/tests/Invoice/Renderer/TwigRendererTest.php b/tests/Invoice/Renderer/TwigRendererTest.php
index f696af94..cb1bc3ba 100644
--- a/tests/Invoice/Renderer/TwigRendererTest.php
+++ b/tests/Invoice/Renderer/TwigRendererTest.php
@@ -16,6 +16,7 @@ use Twig\Environment;
use Twig\Loader\FilesystemLoader;
/**
+ * @covers \App\Invoice\Renderer\AbstractTwigRenderer
* @covers \App\Invoice\Renderer\TwigRenderer
* @group integration
*/
@@ -56,6 +57,7 @@ class TwigRendererTest extends KernelTestCase
$sut = new TwigRenderer($twig);
$model = $this->getInvoiceModel();
+ $model->getTemplate()->setLanguage('de');
$document = $this->getInvoiceDocument('timesheet.html.twig');
$response = $sut->render($document, $model);
diff --git a/tests/Invoice/Renderer/XmlRendererTest.php b/tests/Invoice/Renderer/XmlRendererTest.php
index 45e34385..6f3eb61c 100644
--- a/tests/Invoice/Renderer/XmlRendererTest.php
+++ b/tests/Invoice/Renderer/XmlRendererTest.php
@@ -16,6 +16,7 @@ use Twig\Environment;
use Twig\Loader\FilesystemLoader;
/**
+ * @covers \App\Invoice\Renderer\AbstractTwigRenderer
* @covers \App\Invoice\Renderer\XmlRenderer
* @group integration
*/
diff --git a/tests/Twig/DateExtensionsTest.php b/tests/Twig/DateExtensionsTest.php
index 06fdb349..92cc283f 100644
--- a/tests/Twig/DateExtensionsTest.php
+++ b/tests/Twig/DateExtensionsTest.php
@@ -11,7 +11,6 @@ namespace App\Tests\Twig;
use App\Configuration\LanguageFormattings;
use App\Twig\DateExtensions;
-use App\Utils\LocaleSettings;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -35,14 +34,12 @@ class DateExtensionsTest extends TestCase
$requestStack = new RequestStack();
$requestStack->push($request);
- $localeSettings = new LocaleSettings($requestStack, new LanguageFormattings($dateSettings));
-
- return new DateExtensions($localeSettings);
+ return new DateExtensions($requestStack, new LanguageFormattings($dateSettings));
}
public function testGetFilters()
{
- $filters = ['month_name', 'date_short', 'date_time', 'date_full', 'date_format', 'time', 'hour24'];
+ $filters = ['month_name', 'day_name', 'date_short', 'date_time', 'date_full', 'date_format', 'time', 'hour24'];
$sut = $this->getSut('de', []);
$twigFilters = $sut->getFilters();
$this->assertCount(\count($filters), $twigFilters);
@@ -121,22 +118,39 @@ class DateExtensionsTest extends TestCase
}
/**
- * @param \DateTime $date
- * @param string $result
- * @dataProvider getMonthData
+ * @dataProvider getDayNameTestData
*/
- public function testMonthName(\DateTime $date, $result)
+ public function testDayName(string $locale, string $date, string $expectedName)
{
- $sut = $this->getSut('en', []);
- $this->assertEquals($result, $sut->monthName($date));
+ $sut = $this->getSut($locale, []);
+ self::assertEquals($expectedName, $sut->dayName(new \DateTime($date)));
}
- public function getMonthData()
+ public function getDayNameTestData()
{
return [
- [new \DateTime('January 2016'), 'month.1'],
- [new \DateTime('2016-06-23'), 'month.6'],
- [new \DateTime('2016-12-23'), 'month.12'],
+ ['de', '2020-07-09 12:00:00', 'Donnerstag'],
+ ['en', '2020-07-09 12:00:00', 'Thursday']
+ ];
+ }
+
+ /**
+ * @dataProvider getMonthNameTestData
+ */
+ public function testMonthName(string $locale, string $date, string $expectedName)
+ {
+ $sut = $this->getSut($locale, []);
+ self::assertEquals($expectedName, $sut->monthName(new \DateTime($date)));
+ }
+
+ public function getMonthNameTestData()
+ {
+ return [
+ ['de', '2020-07-09 23:59:59', 'Juli'],
+ ['en', '2020-07-09 23:59:59', 'July'],
+ ['de', 'January 2016', 'Januar'],
+ ['en', 'January 2016', 'January'],
+ ['en', '2016-12-23', 'December'],
];
}
diff --git a/tests/Twig/ExtensionsTest.php b/tests/Twig/ExtensionsTest.php
index 30cbf1ca..a58bf4cd 100644
--- a/tests/Twig/ExtensionsTest.php
+++ b/tests/Twig/ExtensionsTest.php
@@ -9,15 +9,9 @@
namespace App\Tests\Twig;
-use App\Configuration\LanguageFormattings;
-use App\Entity\Timesheet;
use App\Entity\User;
use App\Twig\Extensions;
-use App\Utils\LocaleSettings;
use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\RequestStack;
-use Symfony\Component\Intl\Util\IntlTestHelper;
use Twig\TwigFilter;
use Twig\TwigFunction;
@@ -26,32 +20,15 @@ use Twig\TwigFunction;
*/
class ExtensionsTest extends TestCase
{
- private $localeEn = ['en' => ['date' => 'Y-m-d', 'duration' => '%h:%m h']];
- private $localeDe = ['de' => ['date' => 'd.m.Y', 'duration' => '%h:%m h']];
- private $localeRu = ['ru' => ['date' => 'd.m.Y', 'duration' => '%h:%m h']];
- private $localeFake = ['XX' => ['date' => 'd.m.Y', 'duration' => '%h - %m - %s Zeit']];
-
- /**
- * @param array $locales
- * @param string $locale
- * @return Extensions
- */
- protected function getSut($locales, $locale = 'en')
+ protected function getSut(): Extensions
{
- $request = new Request();
- $request->setLocale($locale);
- $requestStack = new RequestStack();
- $requestStack->push($request);
-
- $localeSettings = new LocaleSettings($requestStack, new LanguageFormattings($locales));
-
- return new Extensions($localeSettings);
+ return new Extensions();
}
public function testGetFilters()
{
- $filters = ['duration', 'duration_decimal', 'money', 'currency', 'country', 'language', 'amount', 'docu_link', 'multiline_indent'];
- $sut = $this->getSut($this->localeDe);
+ $filters = ['docu_link', 'multiline_indent'];
+ $sut = $this->getSut();
$twigFilters = $sut->getFilters();
$this->assertCount(\count($filters), $twigFilters);
$i = 0;
@@ -64,8 +41,8 @@ class ExtensionsTest extends TestCase
public function testGetFunctions()
{
- $functions = ['locales', 'class_name'];
- $sut = $this->getSut($this->localeDe);
+ $functions = ['class_name'];
+ $sut = $this->getSut();
$twigFunctions = $sut->getFunctions();
$this->assertCount(\count($functions), $twigFunctions);
$i = 0;
@@ -76,216 +53,6 @@ class ExtensionsTest extends TestCase
}
}
- public function testLocales()
- {
- $locales = [
- ['code' => 'en', 'name' => 'English'],
- ['code' => 'de', 'name' => 'Deutsch'],
- ['code' => 'ru', 'name' => 'русский'],
- ];
-
- $appLocales = array_merge($this->localeEn, $this->localeDe, $this->localeRu);
- $sut = $this->getSut($appLocales);
- $this->assertEquals($locales, $sut->getLocales());
- }
-
- public function testCurrency()
- {
- $symbols = [
- 'EUR' => '€',
- 'USD' => '$',
- 'RUB' => 'RUB',
- 'rub' => 'RUB',
- 123 => 123,
- ];
-
- $sut = $this->getSut($this->localeEn);
- foreach ($symbols as $name => $symbol) {
- $this->assertEquals($symbol, $sut->currency($name));
- }
- }
-
- public function testCountry()
- {
- $countries = [
- 'DE' => 'Germany',
- 'RU' => 'Russia',
- 'ES' => 'Spain',
- 'es' => 'Spain',
- '12' => '12',
- ];
-
- $sut = $this->getSut($this->localeEn);
- foreach ($countries as $locale => $name) {
- $this->assertEquals($name, $sut->country($locale));
- }
- }
-
- public function testLanguage()
- {
- $languages = [
- 'de' => 'German',
- 'ru' => 'Russian',
- 'es' => 'Spanish',
- 'ES' => 'Spanish',
- '12' => '12',
- ];
-
- $sut = $this->getSut($this->localeEn);
- foreach ($languages as $locale => $name) {
- $this->assertEquals($name, $sut->language($locale));
- }
- }
-
- public function testMoneyNull()
- {
- $sut = $this->getSut($this->localeEn, 'en');
- $this->assertEquals('123.75', $sut->money(123.75));
-
- $sut = $this->getSut($this->localeEn, 'de');
- $this->assertEquals('123.234,755', $sut->money(123234.7554));
- }
-
- /**
- * @dataProvider getMoneyData
- */
- public function testMoney($result, $amount, $currency, $locale)
- {
- $sut = $this->getSut($this->localeEn, $locale);
- $this->assertEquals($result, $sut->money($amount, $currency));
- }
-
- public function getMoneyData()
- {
- return [
- ['0,00 €', null, 'EUR', 'de'],
- ['2.345,00 €', 2345, 'EUR', 'de'],
- ['€2,345.00', 2345, 'EUR', 'en'],
- ['€2,345.01', 2345.009, 'EUR', 'en'],
- ['2.345,01 €', 2345.009, 'EUR', 'de'],
- ['$13.75', 13.75, 'USD', 'en'],
- ['13,75 $', 13.75, 'USD', 'de'],
- ['13,75 RUB', 13.75, 'RUB', 'de'],
- ['14 ¥', 13.75, 'JPY', 'de'],
- ['13 933 ¥', 13933.49, 'JPY', 'ru'],
- ['1.234.567,89 $', 1234567.891234567890000, 'USD', 'de'],
- ];
- }
-
- /**
- * @dataProvider getAmountData
- */
- public function testAmount($result, $amount, $locale)
- {
- $sut = $this->getSut($this->localeEn, $locale);
- $this->assertEquals($result, $sut->amount($amount));
- }
-
- public function getAmountData()
- {
- return [
- ['0', null, 'de'],
- ['2.345,01', 2345.01, 'de'],
- ['2.345', 2345, 'de'],
- ['2,345', 2345, 'en'],
- ['2,345.009', 2345.009, 'en'],
- ['2.345,009', 2345.009, 'de'],
- ['13.75', 13.75, 'en'],
- ['13,75', 13.75, 'de'],
- ['13 933,49', 13933.49, 'ru'],
- ['1.234.567,891', 1234567.891234567890000, 'de'],
- ];
- }
-
- /**
- * @dataProvider getMoneyData62_1
- */
- public function testMoney62_1($result, $amount, $currency, $locale)
- {
- IntlTestHelper::requireFullIntl($this, '62.1');
-
- $sut = $this->getSut($this->localeEn, $locale);
- $this->assertEquals($result, $sut->money($amount, $currency));
- }
-
- public function getMoneyData62_1()
- {
- return [
- ['RUB 13.50', 13.50, 'RUB', 'en'],
- ['13,75 ₽', 13.75, 'RUB', 'ru'],
- ];
- }
-
- public function testDuration()
- {
- $record = $this->getTimesheet(9437);
-
- $sut = $this->getSut($this->localeEn);
- $this->assertEquals('02:37 h', $sut->duration($record->getDuration()));
- $this->assertEquals('2.62', $sut->duration($record->getDuration(), true));
-
- // test Timesheet object
- $this->assertEquals('02:37 h', $sut->duration($record));
- $this->assertEquals('2.62', $sut->duration($record, true));
-
- // test extended format
- $sut = $this->getSut($this->localeFake, 'XX');
- $this->assertEquals('02 - 37 - 17 Zeit', $sut->duration($record->getDuration()));
-
- // test negative duration
- $sut = $this->getSut($this->localeEn, 'en');
- $this->assertEquals('?', $sut->duration('-1'));
-
- // test zero duration
- $sut = $this->getSut($this->localeEn, 'en');
- $this->assertEquals('00:00 h', $sut->duration('0'));
-
- $sut = $this->getSut($this->localeEn, 'en');
-
- $this->assertEquals('00:00 h', $sut->duration(null));
- $this->assertEquals('0', $sut->duration(null, true));
- }
-
- public function testDurationDecimal()
- {
- $record = $this->getTimesheet(9437);
-
- $sut = $this->getSut($this->localeEn);
- $this->assertEquals('2.62', $sut->durationDecimal($record->getDuration()));
-
- // test Timesheet object
- $this->assertEquals('2.62', $sut->durationDecimal($record));
-
- // test extended format
- $sut = $this->getSut($this->localeDe, 'de');
- $this->assertEquals('2,62', $sut->durationDecimal($record->getDuration()));
-
- // test negative duration
- $sut = $this->getSut($this->localeEn, 'en');
- $this->assertEquals('0', $sut->durationDecimal('-1'));
-
- // test zero duration
- $sut = $this->getSut($this->localeEn, 'en');
- $this->assertEquals('0', $sut->durationDecimal('0'));
-
- $sut = $this->getSut($this->localeEn, 'en');
-
- $this->assertEquals('0', $sut->durationDecimal(null));
- }
-
- protected function getTimesheet($seconds)
- {
- $begin = new \DateTime();
- $end = clone $begin;
- $end->setTimestamp($begin->getTimestamp() + $seconds);
- $record = new Timesheet();
- $record->setBegin($begin);
- $record->setEnd($end);
- $record->setDuration($seconds);
-
- return $record;
- }
-
public function testDocuLink()
{
$data = [
@@ -295,7 +62,7 @@ class ExtensionsTest extends TestCase
'' => 'https://www.kimai.org/documentation/',
];
- $sut = $this->getSut($this->localeEn);
+ $sut = $this->getSut();
foreach ($data as $input => $expected) {
$result = $sut->documentationLink($input);
$this->assertEquals($expected, $result);
@@ -304,7 +71,7 @@ class ExtensionsTest extends TestCase
public function testGetClassName()
{
- $sut = $this->getSut($this->localeEn);
+ $sut = $this->getSut();
$this->assertEquals('DateTime', $sut->getClassName(new \DateTime()));
$this->assertEquals('stdClass', $sut->getClassName(new \stdClass()));
$this->assertNull($sut->getClassName(''));
@@ -346,7 +113,7 @@ sdfsdf' . PHP_EOL . "\n" .
*/
public function testMultilineIndent($indent, $string, $expected)
{
- $sut = $this->getSut($this->localeEn);
+ $sut = $this->getSut();
self::assertEquals(implode("\n", $expected), $sut->multilineIndent($string, $indent));
}
}
diff --git a/tests/Twig/LocaleExtensionsTest.php b/tests/Twig/LocaleExtensionsTest.php
new file mode 100644
index 00000000..fb4a2859
--- /dev/null
+++ b/tests/Twig/LocaleExtensionsTest.php
@@ -0,0 +1,321 @@
+ ['date' => 'Y-m-d', 'duration' => '%h:%m h']];
+ private $localeDe = ['de' => ['date' => 'd.m.Y', 'duration' => '%h:%m h']];
+ private $localeRu = ['ru' => ['date' => 'd.m.Y', 'duration' => '%h:%m h']];
+ private $localeFake = ['XX' => ['date' => 'd.m.Y', 'duration' => '%h - %m - %s Zeit']];
+
+ /**
+ * @param array $locales
+ * @param string $locale
+ * @return LocaleExtensions
+ */
+ protected function getSut($locales, $locale = 'en')
+ {
+ $request = new Request();
+ $request->setLocale($locale);
+ $requestStack = new RequestStack();
+ $requestStack->push($request);
+
+ return new LocaleExtensions($requestStack, new LanguageFormattings($locales));
+ }
+
+ public function testGetFilters()
+ {
+ $filters = ['duration', 'duration_decimal', 'money', 'currency', 'country', 'language', 'amount'];
+ $sut = $this->getSut($this->localeDe);
+ $twigFilters = $sut->getFilters();
+ $this->assertCount(\count($filters), $twigFilters);
+ $i = 0;
+ /** @var TwigFilter $filter */
+ foreach ($twigFilters as $filter) {
+ $this->assertInstanceOf(TwigFilter::class, $filter);
+ $this->assertEquals($filters[$i++], $filter->getName());
+ }
+ }
+
+ public function testGetFunctions()
+ {
+ $functions = ['locales'];
+ $sut = $this->getSut($this->localeDe);
+ $twigFunctions = $sut->getFunctions();
+ $this->assertCount(\count($functions), $twigFunctions);
+ $i = 0;
+ /** @var TwigFunction $filter */
+ foreach ($twigFunctions as $filter) {
+ $this->assertInstanceOf(TwigFunction::class, $filter);
+ $this->assertEquals($functions[$i++], $filter->getName());
+ }
+ }
+
+ public function testLocales()
+ {
+ $locales = [
+ ['code' => 'en', 'name' => 'English'],
+ ['code' => 'de', 'name' => 'Deutsch'],
+ ['code' => 'ru', 'name' => 'русский'],
+ ];
+
+ $appLocales = array_merge($this->localeEn, $this->localeDe, $this->localeRu);
+ $sut = $this->getSut($appLocales);
+ $this->assertEquals($locales, $sut->getLocales());
+ }
+
+ public function testCurrency()
+ {
+ $symbols = [
+ 'EUR' => '€',
+ 'USD' => '$',
+ 'RUB' => 'RUB',
+ 'rub' => 'RUB',
+ 123 => 123,
+ ];
+
+ $sut = $this->getSut($this->localeEn);
+ foreach ($symbols as $name => $symbol) {
+ $this->assertEquals($symbol, $sut->currency($name));
+ }
+ }
+
+ public function testCountry()
+ {
+ $countries = [
+ 'DE' => 'Germany',
+ 'RU' => 'Russia',
+ 'ES' => 'Spain',
+ 'es' => 'Spain',
+ '12' => '12',
+ ];
+
+ $sut = $this->getSut($this->localeEn);
+ foreach ($countries as $locale => $name) {
+ $this->assertEquals($name, $sut->country($locale));
+ }
+ }
+
+ public function testLanguage()
+ {
+ $languages = [
+ 'de' => 'German',
+ 'ru' => 'Russian',
+ 'es' => 'Spanish',
+ 'ES' => 'Spanish',
+ '12' => '12',
+ ];
+
+ $sut = $this->getSut($this->localeEn);
+ foreach ($languages as $locale => $name) {
+ $this->assertEquals($name, $sut->language($locale));
+ }
+ }
+
+ public function testMoneyWithoutCurrency()
+ {
+ $sut = $this->getSut($this->localeEn, 'en');
+ $this->assertEquals('123.75', $sut->money(123.75));
+
+ $sut = $this->getSut($this->localeEn, 'de');
+ $this->assertEquals('123.234,76', $sut->money(123234.7554, null, true));
+ $this->assertEquals('123.234,76', $sut->money(123234.7554, null, false));
+ $this->assertEquals('123.234,76', $sut->money(123234.7554, 'EUR', false));
+ }
+
+ /**
+ * @dataProvider getMoneyNoCurrencyData
+ */
+ public function testMoneyNoCurrency($result, $amount, $currency, $locale)
+ {
+ $sut = $this->getSut($this->localeEn, $locale);
+ $this->assertEquals($result, $sut->money($amount, $currency, false));
+ }
+
+ public function getMoneyNoCurrencyData()
+ {
+ return [
+ ['0,00', null, 'EUR', 'de'],
+ ['2.345,00', 2345, 'EUR', 'de'],
+ ['2,345.00', 2345, 'EUR', 'en'],
+ ['2,345.01', 2345.009, 'EUR', 'en'],
+ ['2.345,01', 2345.009, 'EUR', 'de'],
+ ['13.75', 13.75, 'USD', 'en'],
+ ['13,75', 13.75, 'USD', 'de'],
+ ['13,75', 13.75, 'RUB', 'de'],
+ ['13,75', 13.75, 'JPY', 'de'],
+ ['13 933,49', 13933.49, 'JPY', 'ru'],
+ ['13,75', 13.75, 'CNY', 'de'],
+ ['13.933,00', 13933, 'CNY', 'de'],
+ ['13 933,00', 13933, 'CNY', 'ru'],
+ ['13,933.00', 13933, 'CNY', 'en'],
+ ['13,933.00', 13933, 'CNY', 'zh_CN'],
+ ['1.234.567,89', 1234567.891234567890000, 'USD', 'de'],
+ ];
+ }
+
+ /**
+ * @dataProvider getMoneyData
+ */
+ public function testMoney($result, $amount, $currency, $locale)
+ {
+ $sut = $this->getSut($this->localeEn, $locale);
+ $this->assertEquals($result, $sut->money($amount, $currency));
+ }
+
+ public function getMoneyData()
+ {
+ return [
+ ['0,00 €', null, 'EUR', 'de'],
+ ['2.345,00 €', 2345, 'EUR', 'de'],
+ ['€2,345.00', 2345, 'EUR', 'en'],
+ ['€2,345.01', 2345.009, 'EUR', 'en'],
+ ['2.345,01 €', 2345.009, 'EUR', 'de'],
+ ['$13.75', 13.75, 'USD', 'en'],
+ ['13,75 $', 13.75, 'USD', 'de'],
+ ['13,75 RUB', 13.75, 'RUB', 'de'],
+ ['14 ¥', 13.75, 'JPY', 'de'],
+ ['13 933 ¥', 13933.49, 'JPY', 'ru'],
+ ['13,75 CN¥', 13.75, 'CNY', 'de'],
+ ['13.933,00 CN¥', 13933, 'CNY', 'de'],
+ ['13 933,00 CN¥', 13933, 'CNY', 'ru'],
+ ['CN¥13,933.00', 13933, 'CNY', 'en'],
+ ['1.234.567,89 $', 1234567.891234567890000, 'USD', 'de'],
+ ];
+ }
+
+ /**
+ * @dataProvider getAmountData
+ */
+ public function testAmount($result, $amount, $locale)
+ {
+ $sut = $this->getSut($this->localeEn, $locale);
+ $this->assertEquals($result, $sut->amount($amount));
+ }
+
+ public function getAmountData()
+ {
+ return [
+ ['0', null, 'de'],
+ ['2.345,01', 2345.01, 'de'],
+ ['2.345', 2345, 'de'],
+ ['2,345', 2345, 'en'],
+ ['2,345.009', 2345.009, 'en'],
+ ['2.345,009', 2345.009, 'de'],
+ ['13.75', 13.75, 'en'],
+ ['13,75', 13.75, 'de'],
+ ['13 933,49', 13933.49, 'ru'],
+ ['1.234.567,891', 1234567.891234567890000, 'de'],
+ ];
+ }
+
+ /**
+ * @dataProvider getMoneyData62_1
+ */
+ public function testMoney62_1($result, $amount, $currency, $locale)
+ {
+ IntlTestHelper::requireFullIntl($this, '62.1');
+
+ $sut = $this->getSut($this->localeEn, $locale);
+ $this->assertEquals($result, $sut->money($amount, $currency));
+ }
+
+ public function getMoneyData62_1()
+ {
+ return [
+ ['RUB 13.50', 13.50, 'RUB', 'en'],
+ ['13,75 ₽', 13.75, 'RUB', 'ru'],
+ ];
+ }
+
+ public function testDuration()
+ {
+ $record = $this->getTimesheet(9437);
+
+ $sut = $this->getSut($this->localeEn);
+ $this->assertEquals('02:37 h', $sut->duration($record->getDuration()));
+ $this->assertEquals('2.62', $sut->duration($record->getDuration(), true));
+
+ // test Timesheet object
+ $this->assertEquals('02:37 h', $sut->duration($record));
+ $this->assertEquals('2.62', $sut->duration($record, true));
+
+ // test extended format
+ $sut = $this->getSut($this->localeFake, 'XX');
+ $this->assertEquals('02 - 37 - 17 Zeit', $sut->duration($record->getDuration()));
+
+ // test negative duration
+ $sut = $this->getSut($this->localeEn, 'en');
+ $this->assertEquals('?', $sut->duration('-1'));
+
+ // test zero duration
+ $sut = $this->getSut($this->localeEn, 'en');
+ $this->assertEquals('00:00 h', $sut->duration('0'));
+
+ $sut = $this->getSut($this->localeEn, 'en');
+
+ $this->assertEquals('00:00 h', $sut->duration(null));
+ $this->assertEquals('0', $sut->duration(null, true));
+ }
+
+ public function testDurationDecimal()
+ {
+ $record = $this->getTimesheet(9437);
+
+ $sut = $this->getSut($this->localeEn);
+ $this->assertEquals('2.62', $sut->durationDecimal($record->getDuration()));
+
+ // test Timesheet object
+ $this->assertEquals('2.62', $sut->durationDecimal($record));
+
+ // test extended format
+ $sut = $this->getSut($this->localeDe, 'de');
+ $this->assertEquals('2,62', $sut->durationDecimal($record->getDuration()));
+
+ // test negative duration
+ $sut = $this->getSut($this->localeEn, 'en');
+ $this->assertEquals('0', $sut->durationDecimal('-1'));
+
+ // test zero duration
+ $sut = $this->getSut($this->localeEn, 'en');
+ $this->assertEquals('0', $sut->durationDecimal('0'));
+
+ $sut = $this->getSut($this->localeEn, 'en');
+
+ $this->assertEquals('0', $sut->durationDecimal(null));
+ }
+
+ protected function getTimesheet($seconds)
+ {
+ $begin = new \DateTime();
+ $end = clone $begin;
+ $end->setTimestamp($begin->getTimestamp() + $seconds);
+ $record = new Timesheet();
+ $record->setBegin($begin);
+ $record->setEnd($end);
+ $record->setDuration($seconds);
+
+ return $record;
+ }
+}
diff --git a/tests/Utils/LocaleFormatsTest.php b/tests/Utils/LocaleFormatsTest.php
new file mode 100644
index 00000000..14c6ccf7
--- /dev/null
+++ b/tests/Utils/LocaleFormatsTest.php
@@ -0,0 +1,191 @@
+ [
+ 'date_time_type' => 'dd.MM.yyyy HH:mm',
+ 'date_type' => 'dd.MM.yyyy',
+ 'date' => 'd.m.Y',
+ 'date_time' => 'd.m. H:i',
+ 'duration' => '%h:%m h',
+ 'time' => 'H:i',
+ '24_hours' => true,
+ ],
+ 'en' => [
+ 'date_time_type' => 'yyyy-MM-dd HH:mm',
+ 'date_type' => 'yyyy-MM-dd',
+ 'date' => 'Y-m-d',
+ 'date_time' => 'm-d H:i',
+ 'duration' => '%h:%m h',
+ 'time' => 'H:i:s',
+ '24_hours' => false,
+ ],
+ 'pt_BR' => [
+ 'date_time_type' => 'dd-MM-yyyy HH:mm',
+ 'date_type' => 'dd-MM-yyyy',
+ 'date' => 'd-m-Y',
+ 'duration' => '%h:%m h',
+ ],
+ 'it' => [
+ 'date_time_type' => 'dd.MM.yyyy HH:mm',
+ 'date_type' => 'dd.MM.yyyy',
+ 'date' => 'd.m.Y',
+ 'duration' => '%h:%m h',
+ ],
+ 'fr' => [
+ 'date_time_type' => 'dd/MM/yyyy HH:mm',
+ 'date_type' => 'dd/MM/yyyy',
+ 'date' => 'd/m/Y',
+ 'duration' => '%h h %m',
+ ],
+ 'es' => [
+ 'date_time_type' => 'dd.MM.yyyy HH:mm',
+ 'date_type' => 'dd.MM.yyyy',
+ 'date' => 'd.m.Y',
+ 'duration' => '%h:%m h',
+ ],
+ 'ru' => [
+ 'date_time_type' => 'dd.MM.yyyy HH:mm',
+ 'date_type' => 'dd.MM.yyyy',
+ 'date' => 'd.m.Y',
+ 'duration' => '%h:%m h',
+ ],
+ 'ar' => [
+ 'date_time_type' => 'yyyy-MM-dd HH:mm',
+ 'date_type' => 'yyyy-MM-dd',
+ 'date' => 'Y-m-d',
+ 'duration' => '%h:%m h',
+ ],
+ 'hu' => [
+ 'date_time_type' => 'yyyy.MM.dd HH:mm',
+ 'date_type' => 'yyyy.MM.dd',
+ 'date' => 'Y.m.d.',
+ 'duration' => '%h:%m h',
+ ],
+ ];
+ }
+
+ public function testGetLocale()
+ {
+ $sut = $this->getSut('en', []);
+ $this->assertEquals('en', $sut->getLocale());
+ $sut = $this->getSut('ar', []);
+ $this->assertEquals('ar', $sut->getLocale());
+ }
+
+ public function testGetAvailableLanguages()
+ {
+ $sut = $this->getSut('en', []);
+ $this->assertEquals([], $sut->getAvailableLanguages());
+
+ $sut = $this->getSut('en', $this->getDefaultSettings());
+ $this->assertEquals(['de', 'en', 'pt_BR', 'it', 'fr', 'es', 'ru', 'ar', 'hu'], $sut->getAvailableLanguages());
+ }
+
+ public function testInvalidLocaleWithDefaultLocale()
+ {
+ $this->expectException(\InvalidArgumentException::class);
+
+ $sut = $this->getSut('en', []);
+ $sut->getDateFormat();
+ }
+
+ public function testInvalidLocaleWithGivenLocale()
+ {
+ $this->expectException(\InvalidArgumentException::class);
+ $this->expectExceptionMessage('Unknown locale given: xx');
+
+ $sut = $this->getSut('xx', $this->getDefaultSettings());
+ $sut->getDateFormat();
+ }
+
+ public function testGetDurationFormat()
+ {
+ $sut = $this->getSut('en', $this->getDefaultSettings());
+ $this->assertEquals('%h:%m h', $sut->getDurationFormat());
+ }
+
+ public function testGetDateFormat()
+ {
+ $sut = $this->getSut('de', $this->getDefaultSettings());
+ $this->assertEquals('d.m.Y', $sut->getDateFormat());
+ }
+
+ public function testGetDateTimeFormat()
+ {
+ $sut = $this->getSut('en', $this->getDefaultSettings());
+ $this->assertEquals('m-d H:i', $sut->getDateTimeFormat());
+ }
+
+ public function testGetDateTypeFormat()
+ {
+ $sut = $this->getSut('de', $this->getDefaultSettings());
+ $this->assertEquals('dd.MM.yyyy', $sut->getDateTypeFormat());
+ }
+
+ public function testGetDatePickerFormat()
+ {
+ $sut = $this->getSut('en', $this->getDefaultSettings());
+ $this->assertEquals('YYYY-MM-DD', $sut->getDatePickerFormat());
+ }
+
+ public function testGetDateTimeTypeFormat()
+ {
+ $sut = $this->getSut('en', $this->getDefaultSettings());
+ $this->assertEquals('yyyy-MM-dd HH:mm', $sut->getDateTimeTypeFormat());
+ }
+
+ public function testGetDateTimePickerFormat()
+ {
+ $sut = $this->getSut('en', $this->getDefaultSettings());
+ $this->assertEquals('YYYY-MM-DD HH:mm', $sut->getDateTimePickerFormat());
+ }
+
+ public function testIs24Hours()
+ {
+ $sut = $this->getSut('en', $this->getDefaultSettings());
+ $this->assertFalse($sut->isTwentyFourHours());
+ }
+
+ public function testGetTimeFormat()
+ {
+ $sut = $this->getSut('en', $this->getDefaultSettings());
+ $this->assertEquals('H:i:s', $sut->getTimeFormat());
+ }
+
+ public function testUnknownSetting()
+ {
+ $this->expectException(\InvalidArgumentException::class);
+ $this->expectExceptionMessage('Unknown setting for locale en: date_time_type');
+
+ $sut = $this->getSut('en', ['en' => [
+ 'xxx' => 'dd.MM.yyyy HH:mm',
+ ]]);
+ $sut->getDateTimePickerFormat();
+ }
+}
diff --git a/tests/Utils/LocaleHelperTest.php b/tests/Utils/LocaleHelperTest.php
new file mode 100644
index 00000000..b7232541
--- /dev/null
+++ b/tests/Utils/LocaleHelperTest.php
@@ -0,0 +1,223 @@
+ '€',
+ 'USD' => '$',
+ 'RUB' => 'RUB',
+ 'rub' => 'RUB',
+ 123 => 123,
+ ];
+
+ $sut = $this->getSut('en');
+ foreach ($symbols as $name => $symbol) {
+ $this->assertEquals($symbol, $sut->currency($name));
+ }
+ }
+
+ public function testCountry()
+ {
+ $countries = [
+ 'DE' => 'Germany',
+ 'RU' => 'Russia',
+ 'ES' => 'Spain',
+ 'es' => 'Spain',
+ '12' => '12',
+ ];
+
+ $sut = $this->getSut('en');
+ foreach ($countries as $locale => $name) {
+ $this->assertEquals($name, $sut->country($locale));
+ }
+ }
+
+ public function testLanguage()
+ {
+ $languages = [
+ 'de' => 'German',
+ 'ru' => 'Russian',
+ 'es' => 'Spanish',
+ 'ES' => 'Spanish',
+ '12' => '12',
+ ];
+
+ $sut = $this->getSut('en');
+ foreach ($languages as $locale => $name) {
+ $this->assertEquals($name, $sut->language($locale));
+ }
+ }
+
+ public function testMoneyWithoutCurrency()
+ {
+ $sut = $this->getSut('en');
+ $this->assertEquals('123.75', $sut->money(123.75));
+
+ $sut = $this->getSut('de');
+ $this->assertEquals('123.234,76', $sut->money(123234.7554, null, true));
+ $this->assertEquals('123.234,76', $sut->money(123234.7554, null, false));
+ $this->assertEquals('123.234,76', $sut->money(123234.7554, 'EUR', false));
+ }
+
+ /**
+ * @dataProvider getMoneyNoCurrencyData
+ */
+ public function testMoneyNoCurrency($result, $amount, $currency, $locale)
+ {
+ $sut = $this->getSut($locale);
+ $this->assertEquals($result, $sut->money($amount, $currency, false));
+ }
+
+ public function getMoneyNoCurrencyData()
+ {
+ return [
+ ['0,00', null, 'EUR', 'de'],
+ ['2.345,00', 2345, 'EUR', 'de'],
+ ['2,345.00', 2345, 'EUR', 'en'],
+ ['2,345.01', 2345.009, 'EUR', 'en'],
+ ['2.345,01', 2345.009, 'EUR', 'de'],
+ ['13.75', 13.75, 'USD', 'en'],
+ ['13,75', 13.75, 'USD', 'de'],
+ ['13,75', 13.75, 'RUB', 'de'],
+ ['13,75', 13.75, 'JPY', 'de'],
+ ['13 933,49', 13933.49, 'JPY', 'ru'],
+ ['13,75', 13.75, 'CNY', 'de'],
+ ['13.933,00', 13933, 'CNY', 'de'],
+ ['13 933,00', 13933, 'CNY', 'ru'],
+ ['13,933.00', 13933, 'CNY', 'en'],
+ ['13,933.00', 13933, 'CNY', 'zh_CN'],
+ ['1.234.567,89', 1234567.891234567890000, 'USD', 'de'],
+ ];
+ }
+
+ /**
+ * @dataProvider getMoneyData
+ */
+ public function testMoney($result, $amount, $currency, $locale)
+ {
+ $sut = $this->getSut($locale);
+ $this->assertEquals($result, $sut->money($amount, $currency));
+ }
+
+ public function getMoneyData()
+ {
+ return [
+ ['0,00 €', null, 'EUR', 'de'],
+ ['2.345,00 €', 2345, 'EUR', 'de'],
+ ['€2,345.00', 2345, 'EUR', 'en'],
+ ['€2,345.01', 2345.009, 'EUR', 'en'],
+ ['2.345,01 €', 2345.009, 'EUR', 'de'],
+ ['$13.75', 13.75, 'USD', 'en'],
+ ['13,75 $', 13.75, 'USD', 'de'],
+ ['13,75 RUB', 13.75, 'RUB', 'de'],
+ ['14 ¥', 13.75, 'JPY', 'de'],
+ ['13 933 ¥', 13933.49, 'JPY', 'ru'],
+ ['13,75 CN¥', 13.75, 'CNY', 'de'],
+ ['13.933,00 CN¥', 13933, 'CNY', 'de'],
+ ['13 933,00 CN¥', 13933, 'CNY', 'ru'],
+ ['CN¥13,933.00', 13933, 'CNY', 'en'],
+ ['1.234.567,89 $', 1234567.891234567890000, 'USD', 'de'],
+ ];
+ }
+
+ /**
+ * @dataProvider getAmountData
+ */
+ public function testAmount($result, $amount, $locale)
+ {
+ $sut = $this->getSut($locale);
+ $this->assertEquals($result, $sut->amount($amount));
+ }
+
+ public function getAmountData()
+ {
+ return [
+ ['0', null, 'de'],
+ ['2.345,01', 2345.01, 'de'],
+ ['2.345', 2345, 'de'],
+ ['2,345', 2345, 'en'],
+ ['2,345.009', 2345.009, 'en'],
+ ['2.345,009', 2345.009, 'de'],
+ ['13.75', 13.75, 'en'],
+ ['13,75', 13.75, 'de'],
+ ['13 933,49', 13933.49, 'ru'],
+ ['1.234.567,891', 1234567.891234567890000, 'de'],
+ ];
+ }
+
+ /**
+ * @dataProvider getMoneyData62_1
+ */
+ public function testMoney62_1($result, $amount, $currency, $locale)
+ {
+ IntlTestHelper::requireFullIntl($this, '62.1');
+
+ $sut = $this->getSut($locale);
+ $this->assertEquals($result, $sut->money($amount, $currency));
+ }
+
+ public function getMoneyData62_1()
+ {
+ return [
+ ['RUB 13.50', 13.50, 'RUB', 'en'],
+ ['13,75 ₽', 13.75, 'RUB', 'ru'],
+ ];
+ }
+
+ public function testDurationDecimal()
+ {
+ $record = $this->getTimesheet(9437);
+
+ $sut = $this->getSut('en');
+ $this->assertEquals('2.62', $sut->durationDecimal($record->getDuration()));
+
+ // test extended format
+ $sut = $this->getSut('de');
+ $this->assertEquals('2,62', $sut->durationDecimal($record->getDuration()));
+
+ // test negative duration
+ $sut = $this->getSut('en');
+ $this->assertEquals('0', $sut->durationDecimal('-1'));
+
+ // test zero duration
+ $sut = $this->getSut('en');
+ $this->assertEquals('0', $sut->durationDecimal('0'));
+ }
+
+ protected function getTimesheet($seconds)
+ {
+ $begin = new \DateTime();
+ $end = clone $begin;
+ $end->setTimestamp($begin->getTimestamp() + $seconds);
+ $record = new Timesheet();
+ $record->setBegin($begin);
+ $record->setEnd($end);
+ $record->setDuration($seconds);
+
+ return $record;
+ }
+}
diff --git a/tests/Utils/LocaleSettingsTest.php b/tests/Utils/LocaleSettingsTest.php
index f827a5c0..094a286d 100644
--- a/tests/Utils/LocaleSettingsTest.php
+++ b/tests/Utils/LocaleSettingsTest.php
@@ -11,7 +11,6 @@ namespace App\Tests\Utils;
use App\Configuration\LanguageFormattings;
use App\Utils\LocaleSettings;
-use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -19,185 +18,15 @@ use Symfony\Component\HttpFoundation\RequestStack;
* @covers \App\Utils\LocaleSettings
* @covers \App\Configuration\LanguageFormattings
*/
-class LocaleSettingsTest extends TestCase
+class LocaleSettingsTest extends LocaleFormatsTest
{
- protected function getRequestStack(string $locale)
+ protected function getSut(string $locale, array $settings)
{
$request = new Request();
$request->setLocale($locale);
$requestStack = new RequestStack();
$requestStack->push($request);
- return $requestStack;
- }
-
- protected function getSut(string $locale, array $settings)
- {
- return new LocaleSettings($this->getRequestStack($locale), new LanguageFormattings($settings));
- }
-
- protected function getDefaultSettings()
- {
- return [
- 'de' => [
- 'date_time_type' => 'dd.MM.yyyy HH:mm',
- 'date_type' => 'dd.MM.yyyy',
- 'date' => 'd.m.Y',
- 'date_time' => 'd.m. H:i',
- 'duration' => '%h:%m h',
- 'time' => 'H:i',
- '24_hours' => true,
- ],
- 'en' => [
- 'date_time_type' => 'yyyy-MM-dd HH:mm',
- 'date_type' => 'yyyy-MM-dd',
- 'date' => 'Y-m-d',
- 'date_time' => 'm-d H:i',
- 'duration' => '%h:%m h',
- 'time' => 'H:i:s',
- '24_hours' => false,
- ],
- 'pt_BR' => [
- 'date_time_type' => 'dd-MM-yyyy HH:mm',
- 'date_type' => 'dd-MM-yyyy',
- 'date' => 'd-m-Y',
- 'duration' => '%h:%m h',
- ],
- 'it' => [
- 'date_time_type' => 'dd.MM.yyyy HH:mm',
- 'date_type' => 'dd.MM.yyyy',
- 'date' => 'd.m.Y',
- 'duration' => '%h:%m h',
- ],
- 'fr' => [
- 'date_time_type' => 'dd/MM/yyyy HH:mm',
- 'date_type' => 'dd/MM/yyyy',
- 'date' => 'd/m/Y',
- 'duration' => '%h h %m',
- ],
- 'es' => [
- 'date_time_type' => 'dd.MM.yyyy HH:mm',
- 'date_type' => 'dd.MM.yyyy',
- 'date' => 'd.m.Y',
- 'duration' => '%h:%m h',
- ],
- 'ru' => [
- 'date_time_type' => 'dd.MM.yyyy HH:mm',
- 'date_type' => 'dd.MM.yyyy',
- 'date' => 'd.m.Y',
- 'duration' => '%h:%m h',
- ],
- 'ar' => [
- 'date_time_type' => 'yyyy-MM-dd HH:mm',
- 'date_type' => 'yyyy-MM-dd',
- 'date' => 'Y-m-d',
- 'duration' => '%h:%m h',
- ],
- 'hu' => [
- 'date_time_type' => 'yyyy.MM.dd HH:mm',
- 'date_type' => 'yyyy.MM.dd',
- 'date' => 'Y.m.d.',
- 'duration' => '%h:%m h',
- ],
- ];
- }
-
- public function testGetLocale()
- {
- $sut = $this->getSut('en', []);
- $this->assertEquals('en', $sut->getLocale());
- $sut = $this->getSut('ar', []);
- $this->assertEquals('ar', $sut->getLocale());
- }
-
- public function testGetAvailableLanguages()
- {
- $sut = $this->getSut('en', []);
- $this->assertEquals([], $sut->getAvailableLanguages());
-
- $sut = $this->getSut('en', $this->getDefaultSettings());
- $this->assertEquals(['de', 'en', 'pt_BR', 'it', 'fr', 'es', 'ru', 'ar', 'hu'], $sut->getAvailableLanguages());
- }
-
- public function testInvalidLocaleWithDefaultLocale()
- {
- $this->expectException(\InvalidArgumentException::class);
-
- $sut = $this->getSut('en', []);
- $sut->getDateFormat();
- }
-
- public function testInvalidLocaleWithGivenLocale()
- {
- $this->expectException(\InvalidArgumentException::class);
- $this->expectExceptionMessage('Unknown locale given: xx');
-
- $sut = $this->getSut('xx', $this->getDefaultSettings());
- $sut->getDateFormat();
- }
-
- public function testGetDurationFormat()
- {
- $sut = $this->getSut('en', $this->getDefaultSettings());
- $this->assertEquals('%h:%m h', $sut->getDurationFormat());
- }
-
- public function testGetDateFormat()
- {
- $sut = $this->getSut('de', $this->getDefaultSettings());
- $this->assertEquals('d.m.Y', $sut->getDateFormat());
- }
-
- public function testGetDateTimeFormat()
- {
- $sut = $this->getSut('en', $this->getDefaultSettings());
- $this->assertEquals('m-d H:i', $sut->getDateTimeFormat());
- }
-
- public function testGetDateTypeFormat()
- {
- $sut = $this->getSut('de', $this->getDefaultSettings());
- $this->assertEquals('dd.MM.yyyy', $sut->getDateTypeFormat());
- }
-
- public function testGetDatePickerFormat()
- {
- $sut = $this->getSut('en', $this->getDefaultSettings());
- $this->assertEquals('YYYY-MM-DD', $sut->getDatePickerFormat());
- }
-
- public function testGetDateTimeTypeFormat()
- {
- $sut = $this->getSut('en', $this->getDefaultSettings());
- $this->assertEquals('yyyy-MM-dd HH:mm', $sut->getDateTimeTypeFormat());
- }
-
- public function testGetDateTimePickerFormat()
- {
- $sut = $this->getSut('en', $this->getDefaultSettings());
- $this->assertEquals('YYYY-MM-DD HH:mm', $sut->getDateTimePickerFormat());
- }
-
- public function testIs24Hours()
- {
- $sut = $this->getSut('en', $this->getDefaultSettings());
- $this->assertFalse($sut->isTwentyFourHours());
- }
-
- public function testGetTimeFormat()
- {
- $sut = $this->getSut('en', $this->getDefaultSettings());
- $this->assertEquals('H:i:s', $sut->getTimeFormat());
- }
-
- public function testUnknownSetting()
- {
- $this->expectException(\InvalidArgumentException::class);
- $this->expectExceptionMessage('Unknown setting for locale en: date_time_type');
-
- $sut = $this->getSut('en', ['en' => [
- 'xxx' => 'dd.MM.yyyy HH:mm',
- ]]);
- $sut->getDateTimePickerFormat();
+ return new LocaleSettings($requestStack, new LanguageFormattings($settings));
}
}
diff --git a/translations/messages.ar.xlf b/translations/messages.ar.xlf
index 9eacd7b5..6f4901d4 100755
--- a/translations/messages.ar.xlf
+++ b/translations/messages.ar.xlf
@@ -650,58 +650,6 @@
حساب البنك
-
-
- month.1
- يناير
-
-
- month.2
- فبراير
-
-
- month.3
- آذار
-
-
- month.4
- نيسان
-
-
- month.5
- مايو
-
-
- month.6
- يونيو
-
-
- month.7
- يوليو
-
-
- month.8
- أغسطس
-
-
- month.9
- سبتمبر
-
-
- month.10
- أكتوبر
-
-
- month.11
- نوفمبر
-
-
- month.12
- ديسمبر
-
-
diff --git a/translations/messages.cs.xlf b/translations/messages.cs.xlf
index 955efd0c..9936370d 100644
--- a/translations/messages.cs.xlf
+++ b/translations/messages.cs.xlf
@@ -897,58 +897,6 @@
Vytvořeno %date% s %kimai%
-
-
- month.1
- Leden
-
-
- month.2
- Únor
-
-
- month.3
- Březen
-
-
- month.4
- Doben
-
-
- month.5
- Květen
-
-
- month.6
- Červen
-
-
- month.7
- Červenec
-
-
- month.8
- Srpen
-
-
- month.9
- Září
-
-
- month.10
- Říjen
-
-
- month.11
- Listopad
-
-
- month.12
- Prosinec
-
-
diff --git a/translations/messages.da.xlf b/translations/messages.da.xlf
index ac3c365d..efd4edff 100644
--- a/translations/messages.da.xlf
+++ b/translations/messages.da.xlf
@@ -945,58 +945,6 @@
Oprettet %date% med %kimai%
-
-
- month.1
- Januar
-
-
- month.2
- Februar
-
-
- month.3
- Marts
-
-
- month.4
- April
-
-
- month.5
- Maj
-
-
- month.6
- Juni
-
-
- month.7
- Juli
-
-
- month.8
- August
-
-
- month.9
- September
-
-
- month.10
- Oktober
-
-
- month.11
- November
-
-
- month.12
- December
-
-
diff --git a/translations/messages.de.xlf b/translations/messages.de.xlf
index 88e54828..98c798c8 100644
--- a/translations/messages.de.xlf
+++ b/translations/messages.de.xlf
@@ -1045,58 +1045,6 @@
Erstellt %date% mit %kimai%
-
-
- month.1
- Januar
-
-
- month.2
- Februar
-
-
- month.3
- März
-
-
- month.4
- April
-
-
- month.5
- Mai
-
-
- month.6
- Juni
-
-
- month.7
- Juli
-
-
- month.8
- August
-
-
- month.9
- September
-
-
- month.10
- Oktober
-
-
- month.11
- November
-
-
- month.12
- Dezember
-
-
diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf
index fefabc00..ecc1a0d1 100644
--- a/translations/messages.en.xlf
+++ b/translations/messages.en.xlf
@@ -1045,58 +1045,6 @@
Created %date% with %kimai%
-
-
- month.1
- January
-
-
- month.2
- February
-
-
- month.3
- March
-
-
- month.4
- April
-
-
- month.5
- May
-
-
- month.6
- June
-
-
- month.7
- July
-
-
- month.8
- August
-
-
- month.9
- September
-
-
- month.10
- October
-
-
- month.11
- November
-
-
- month.12
- December
-
-
diff --git a/translations/messages.eo.xlf b/translations/messages.eo.xlf
index 27cae4cf..6b820b9e 100644
--- a/translations/messages.eo.xlf
+++ b/translations/messages.eo.xlf
@@ -1009,58 +1009,6 @@
Kreita je la %date% per %kimai%
-
-
- month.1
- Januaro
-
-
- month.2
- Februaro
-
-
- month.3
- Marto
-
-
- month.4
- Aprilo
-
-
- month.5
- Majo
-
-
- month.6
- Junio
-
-
- month.7
- Julio
-
-
- month.8
- Aŭgusto
-
-
- month.9
- Septembro
-
-
- month.10
- Octobro
-
-
- month.11
- Novembro
-
-
- month.12
- Decembro
-
-
diff --git a/translations/messages.es.xlf b/translations/messages.es.xlf
index 26ee4b52..76635313 100644
--- a/translations/messages.es.xlf
+++ b/translations/messages.es.xlf
@@ -913,58 +913,6 @@
Creado el %date% con %kimai%
-
-
- month.1
- Enero
-
-
- month.2
- Febrero
-
-
- month.3
- Marzo
-
-
- month.4
- Abril
-
-
- month.5
- Mayo
-
-
- month.6
- Junio
-
-
- month.7
- Julio
-
-
- month.8
- Agosto
-
-
- month.9
- Septiembre
-
-
- month.10
- Octubre
-
-
- month.11
- Noviembre
-
-
- month.12
- Diciembre
-
-
diff --git a/translations/messages.eu.xlf b/translations/messages.eu.xlf
index 49445069..9d548d99 100644
--- a/translations/messages.eu.xlf
+++ b/translations/messages.eu.xlf
@@ -953,58 +953,6 @@
%date%-n sortua %kimai%-ren bitartez
-
-
- month.1
- Urtarrila
-
-
- month.2
- Otsaila
-
-
- month.3
- Martxoa
-
-
- month.4
- Apirila
-
-
- month.5
- Maiatza
-
-
- month.6
- Ekaina
-
-
- month.7
- Uztaila
-
-
- month.8
- Abuztua
-
-
- month.9
- Iraila
-
-
- month.10
- Urria
-
-
- month.11
- Azaroa
-
-
- month.12
- Abendua
-
-
diff --git a/translations/messages.fr.xlf b/translations/messages.fr.xlf
index 15e2aab7..3d162d26 100644
--- a/translations/messages.fr.xlf
+++ b/translations/messages.fr.xlf
@@ -837,58 +837,6 @@
Généré le %date% avec %kimai%
-
-
- month.1
- Janvier
-
-
- month.2
- Février
-
-
- month.3
- Mars
-
-
- month.4
- Avril
-
-
- month.5
- Mai
-
-
- month.6
- Juin
-
-
- month.7
- Juillet
-
-
- month.8
- Août
-
-
- month.9
- Septembre
-
-
- month.10
- Octobre
-
-
- month.11
- Novembre
-
-
- month.12
- Decembre
-
-
diff --git a/translations/messages.he.xlf b/translations/messages.he.xlf
index 409d2e0d..4c78b026 100644
--- a/translations/messages.he.xlf
+++ b/translations/messages.he.xlf
@@ -943,54 +943,6 @@
export.date_copyright
נוצר ב %date%
-
- month.1
- ינואר
-
-
- month.2
- פברואר
-
-
- month.3
- מרץ
-
-
- month.4
- אפריל
-
-
- month.5
- מאי
-
-
- month.6
- יוני
-
-
- month.7
- יולי
-
-
- month.8
- אוגוסט
-
-
- month.9
- ספטמבר
-
-
- month.10
- אוקטובר
-
-
- month.11
- נובמבר
-
-
- month.12
- דצמבר
-
active.entries
מדדי זמני הפעילות שלך
diff --git a/translations/messages.hu.xlf b/translations/messages.hu.xlf
index 45ce6bc5..4c6e2703 100644
--- a/translations/messages.hu.xlf
+++ b/translations/messages.hu.xlf
@@ -837,58 +837,6 @@
Készült: %date% A %kimai% segítségével
-
-
- month.1
- Január
-
-
- month.2
- Február
-
-
- month.3
- Március
-
-
- month.4
- Április
-
-
- month.5
- Május
-
-
- month.6
- Június
-
-
- month.7
- Július
-
-
- month.8
- Augusztus
-
-
- month.9
- Szeptember
-
-
- month.10
- Október
-
-
- month.11
- November
-
-
- month.12
- December
-
-
diff --git a/translations/messages.it.xlf b/translations/messages.it.xlf
index a2ae4243..29883813 100755
--- a/translations/messages.it.xlf
+++ b/translations/messages.it.xlf
@@ -985,58 +985,6 @@
Creato %date% con %kimai%
-
-
- month.1
- Gennaio
-
-
- month.2
- Febbraio
-
-
- month.3
- Marzo
-
-
- month.4
- Aprile
-
-
- month.5
- Maggio
-
-
- month.6
- Giugno
-
-
- month.7
- Luglio
-
-
- month.8
- Agosto
-
-
- month.9
- Settembre
-
-
- month.10
- Ottobre
-
-
- month.11
- Novembre
-
-
- month.12
- Dicembre
-
-
diff --git a/translations/messages.ja.xlf b/translations/messages.ja.xlf
index 44091789..13910ac5 100644
--- a/translations/messages.ja.xlf
+++ b/translations/messages.ja.xlf
@@ -837,58 +837,6 @@
%kimai% で %date% に作成されました
-
-
- month.1
- 1 月
-
-
- month.2
- 2 月
-
-
- month.3
- 3 月
-
-
- month.4
- 4 月
-
-
- month.5
- 5 月
-
-
- month.6
- 6 月
-
-
- month.7
- 7 月
-
-
- month.8
- 8 月
-
-
- month.9
- 9 月
-
-
- month.10
- 10 月
-
-
- month.11
- 11 月
-
-
- month.12
- 12 月
-
-
diff --git a/translations/messages.ko.xlf b/translations/messages.ko.xlf
index 3e0758b3..410dde12 100755
--- a/translations/messages.ko.xlf
+++ b/translations/messages.ko.xlf
@@ -857,58 +857,6 @@
생성 %date% 의 %kimai%
-
-
- month.1
- 1월
-
-
- month.2
- 2월
-
-
- month.3
- 3월
-
-
- month.4
- 4월
-
-
- month.5
- 5월
-
-
- month.6
- 6월
-
-
- month.7
- 7월
-
-
- month.8
- 8월
-
-
- month.9
- 9월
-
-
- month.10
- 10월
-
-
- month.11
- 11월
-
-
- month.12
- 12월
-
-
diff --git a/translations/messages.nl.xlf b/translations/messages.nl.xlf
index c74fdf86..420cf2f7 100644
--- a/translations/messages.nl.xlf
+++ b/translations/messages.nl.xlf
@@ -913,58 +913,6 @@
Gemaakt op %date% met %kimai%
-
-
- month.1
- Januari
-
-
- month.2
- Februari
-
-
- month.3
- Maart
-
-
- month.4
- April
-
-
- month.5
- Mei
-
-
- month.6
- Juni
-
-
- month.7
- Juli
-
-
- month.8
- Augustus
-
-
- month.9
- September
-
-
- month.10
- Oktober
-
-
- month.11
- November
-
-
- month.12
- December
-
-
diff --git a/translations/messages.pl.xlf b/translations/messages.pl.xlf
index ca56d06e..01068562 100644
--- a/translations/messages.pl.xlf
+++ b/translations/messages.pl.xlf
@@ -973,58 +973,6 @@
Utworzono %date% za pomocą %kimai%
-
-
- month.1
- styczeń
-
-
- month.2
- Luty
-
-
- month.3
- Marzec
-
-
- month.4
- Kwiecień
-
-
- month.5
- Maj
-
-
- month.6
- Czerwiec
-
-
- month.7
- Lipiec
-
-
- month.8
- Sierpień
-
-
- month.9
- Wrzesień
-
-
- month.10
- Pażdziernik
-
-
- month.11
- Listopad
-
-
- month.12
- Grudzień
-
-
diff --git a/translations/messages.pt_BR.xlf b/translations/messages.pt_BR.xlf
index 022cc0ab..02aa42d3 100644
--- a/translations/messages.pt_BR.xlf
+++ b/translations/messages.pt_BR.xlf
@@ -837,58 +837,6 @@
Criado %date% com %kimai%
-
-
- month.1
- Janeiro
-
-
- month.2
- Fevereiro
-
-
- month.3
- Março
-
-
- month.4
- Abril
-
-
- month.5
- Maio
-
-
- month.6
- Junho
-
-
- month.7
- Julho
-
-
- month.8
- Agosto
-
-
- month.9
- Setembro
-
-
- month.10
- Outubro
-
-
- month.11
- Novembro
-
-
- month.12
- Dezembro
-
-
diff --git a/translations/messages.ro.xlf b/translations/messages.ro.xlf
index 149e3894..85f94043 100755
--- a/translations/messages.ro.xlf
+++ b/translations/messages.ro.xlf
@@ -907,54 +907,7 @@
export.date_copyright
Creat în %date% cu %kimai%
-
- month.1
- Ianuarie
-
-
- month.2
- Februarie
-
-
- month.3
- Martie
-
-
- month.4
- Aprilie
-
-
- month.5
- Mai
-
-
- month.6
- Iunie
-
-
- month.7
- Iulie
-
-
- month.8
- August
-
-
- month.9
- Septembrie
-
-
- month.10
- Octombrie
-
-
- month.11
- Noiembrie
-
-
- month.12
- Decembrie
-
+
active.entries
Înregistrările tale active
diff --git a/translations/messages.ru.xlf b/translations/messages.ru.xlf
index 66a5a6c9..c3bc56be 100644
--- a/translations/messages.ru.xlf
+++ b/translations/messages.ru.xlf
@@ -657,58 +657,6 @@
Номер заказа
-
-
- month.1
- Январь
-
-
- month.2
- Февраль
-
-
- month.3
- Март
-
-
- month.4
- Апрель
-
-
- month.5
- Май
-
-
- month.6
- Июнь
-
-
- month.7
- Июль
-
-
- month.8
- Август
-
-
- month.9
- Сентябрь
-
-
- month.10
- Октябрь
-
-
- month.11
- Ноябрь
-
-
- month.12
- Декабрь
-
-
diff --git a/translations/messages.sk.xlf b/translations/messages.sk.xlf
index 84c084b5..e09f99b2 100644
--- a/translations/messages.sk.xlf
+++ b/translations/messages.sk.xlf
@@ -990,58 +990,6 @@
Vytvorené %date%
-
-
- month.1
- Január
-
-
- month.2
- Február
-
-
- month.3
- Marec
-
-
- month.4
- Apríl
-
-
- month.5
- Máj
-
-
- month.6
- Jún
-
-
- month.7
- Júl
-
-
- month.8
- August
-
-
- month.9
- September
-
-
- month.10
- Október
-
-
- month.11
- November
-
-
- month.12
- December
-
-
diff --git a/translations/messages.sv.xlf b/translations/messages.sv.xlf
index 10020645..b7e2b617 100755
--- a/translations/messages.sv.xlf
+++ b/translations/messages.sv.xlf
@@ -832,58 +832,6 @@
Skapad %date% med %kimai%
-
-
- month.1
- Januari
-
-
- month.2
- Februari
-
-
- month.3
- Mars
-
-
- month.4
- April
-
-
- month.5
- Maj
-
-
- month.6
- Juni
-
-
- month.7
- Juli
-
-
- month.8
- Augusti
-
-
- month.9
- September
-
-
- month.10
- Oktober
-
-
- month.11
- November
-
-
- month.12
- December
-
-
diff --git a/translations/messages.tr.xlf b/translations/messages.tr.xlf
index c12a27bd..ec505f45 100644
--- a/translations/messages.tr.xlf
+++ b/translations/messages.tr.xlf
@@ -913,58 +913,6 @@
%date% günü %kimai% ile oluşturuldu.
-
-
- month.1
- Ocak
-
-
- month.2
- Şubat
-
-
- month.3
- Mart
-
-
- month.4
- Nisan
-
-
- month.5
- Mayıs
-
-
- month.6
- Haziran
-
-
- month.7
- Temmuz
-
-
- month.8
- Ağustos
-
-
- month.9
- Eylül
-
-
- month.10
- Ekim
-
-
- month.11
- Kasım
-
-
- month.12
- Aralık
-
-
diff --git a/translations/messages.vi.xlf b/translations/messages.vi.xlf
index 6ec80c46..a87e4972 100644
--- a/translations/messages.vi.xlf
+++ b/translations/messages.vi.xlf
@@ -1025,58 +1025,6 @@
Tạo %date% với %kimai%
-
-
- month.1
- Tháng 1
-
-
- month.2
- Tháng 2
-
-
- month.3
- Tháng 3
-
-
- month.4
- Tháng 4
-
-
- month.5
- Tháng 5
-
-
- month.6
- Tháng 6
-
-
- month.7
- Tháng 7
-
-
- month.8
- Tháng 8
-
-
- month.9
- Tháng 9
-
-
- month.10
- Tháng 10
-
-
- month.11
- Tháng 11
-
-
- month.12
- Tháng 12
-
-
diff --git a/translations/messages.zh_CN.xlf b/translations/messages.zh_CN.xlf
index 267ec84c..37ae4eac 100644
--- a/translations/messages.zh_CN.xlf
+++ b/translations/messages.zh_CN.xlf
@@ -944,58 +944,6 @@
创建了 %date% 与 %kimai%
-
-
- month.1
- 一月
-
-
- month.2
- 二月
-
-
- month.3
- 三月
-
-
- month.4
- 四月
-
-
- month.5
- 五月
-
-
- month.6
- 六月
-
-
- month.7
- 七月
-
-
- month.8
- 八月
-
-
- month.9
- 九月
-
-
- month.10
- 十月
-
-
- month.11
- 十一月
-
-
- month.12
- 十二月
-
-
| {{ 'invoice.from'|trans({}, 'messages', language) }} | +{{ 'invoice.from'|trans }} | {% if model.query.user is not empty %} {{ widgets.username(model.query.user) }} @@ -27,17 +25,17 @@ | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ 'label.date'|trans({}, 'messages', language) }} | +{{ 'label.date'|trans }} | {% if model.query.begin|date('m') != model.query.end|date('m') or model.query.begin|date('Y') != model.query.end|date('Y') %} {{ model.query.begin|date_short }} - {{ model.query.end|date_short }} {% else %} - {{ model.query.end|month_name|trans({}, 'messages', language) }} {{ model.query.end|date('Y') }} + {{ model.query.end|month_name }} {{ model.query.end|date('Y') }} {% endif %} | ||||||||||||||||||||
| {{ 'label.customer'|trans({}, 'messages', language) }} | +{{ 'label.customer'|trans }} | {% if model.customer.number is not empty %}[{{ model.customer.number }}]{% endif %} {{ model.customer.name }}{% if model.customer.contact is not empty %} / {{ model.customer.contact }}{% endif %} @@ -45,7 +43,7 @@ | ||||||||||||||||||||
| {{ 'label.orderNumber'|trans({}, 'messages', language) }} | +{{ 'label.orderNumber'|trans }} | {{ model.query.project.orderNumber }} | @@ -60,12 +58,12 @@
| {{ 'label.date'|trans({}, 'messages', language) }} | +{{ 'label.date'|trans }} | {% if model.query.user is empty %} -{{ 'label.user'|trans({}, 'messages', language) }} | +{{ 'label.user'|trans }} | {% endif %} -{{ 'label.activity'|trans({}, 'messages', language) }} | -{{ 'label.hours'|trans({}, 'messages', language) }} | +{{ 'label.activity'|trans }} | +{{ 'label.hours'|trans }} | {% endif %} - | {{ 'invoice.total_working_time'|trans({}, 'messages', language) }} | +{{ 'invoice.total_working_time'|trans }} | {{ model.calculator.timeWorked|duration(isDecimal) }} | @@ -103,7 +101,7 @@
|---|
| {{ 'invoice.signature_user'|trans({}, 'messages', language) }} | +{{ 'invoice.signature_user'|trans }} |
|---|---|
| {{ 'invoice.signature_customer'|trans({}, 'messages', language) }} | +{{ 'invoice.signature_customer'|trans }} |