Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix #1652
James Cole3b8e95fcca17
diff --git a/app/Import/Storage/ImportArrayStorage.php b/app/Import/Storage/ImportArrayStorage.phpindex 56dbf5be3e..54481974b7 100644--- a/app/Import/Storage/ImportArrayStorage.php+++ b/app/Import/Storage/ImportArrayStorage.php@@ -31,6 +31,7 @@ use FireflyIII\Events\RequestedReportOnJournals;use FireflyIII\Exceptions\FireflyException;use FireflyIII\Helpers\Collector\GroupCollectorInterface;use FireflyIII\Models\ImportJob;+use FireflyIII\Models\Preference;use FireflyIII\Models\Rule;use FireflyIII\Models\TransactionGroup;use FireflyIII\Models\TransactionType;@@ -68,6 +69,9 @@ class ImportArrayStorage/** @var TransactionGroupRepositoryInterface */private $groupRepos;+ /** @var string */+ private $language = 'en_US';+/*** Set job, count transfers in the array and create the repository.*@@ -87,6 +91,11 @@ class ImportArrayStorage$this->groupRepos = app(TransactionGroupRepositoryInterface::class);$this->groupRepos->setUser($importJob->user);+ // get language of user.+ /** @var Preference $pref */+ $pref = app('preferences')->get('language', config('firefly.default_language', 'en_US'));+ $this->language = $pref->data;+Log::debug('Constructed ImportArrayStorage()');}@@ -276,7 +285,7 @@ class ImportArrayStorage$hash = $this->getHash($transaction);$existingId = $this->hashExists($hash);if (null !== $existingId) {- $message = sprintf('Row #%d ("%s") could not be imported. It already exists.', $index, $transaction['description']);+ $message = (string)trans('import.duplicate_row', ['row' => $index, 'description' => $transaction['description']]);$this->logDuplicateObject($transaction, $existingId);$this->repository->addErrorMessage($this->importJob, $message);@@ -285,7 +294,7 @@ class ImportArrayStorage// do transfer detection:if ($this->checkForTransfers && $this->transferExists($transaction)) {- $message = sprintf('Row #%d ("%s") could not be imported. Such a transfer already exists.', $index, $transaction['description']);+ $message = (string)trans('import.duplicate_row', ['row' => $index, 'description' => $transaction['description']]);$this->logDuplicateTransfer($transaction);$this->repository->addErrorMessage($this->importJob, $message);diff --git a/resources/lang/en_US/import.php b/resources/lang/en_US/import.phpindex 7bd146fa73..3a907af062 100644--- a/resources/lang/en_US/import.php+++ b/resources/lang/en_US/import.php@@ -310,4 +310,7 @@ return ['column_note' => 'Note(s)','column_internal-reference' => 'Internal reference',+ // error message+ 'duplicate_row' => 'Row #:row (":description") could not be imported. It already exists.',+];