Fix translations.

This commit is contained in:
James Cole
2025-08-15 11:38:25 +02:00
parent 0b3fd335ad
commit 0e29e282df
3 changed files with 204 additions and 206 deletions

View File

@@ -60,11 +60,11 @@ class StoreByCurrenciesRequest extends FormRequest
try { try {
$date = Carbon::createFromFormat('Y-m-d', $date); $date = Carbon::createFromFormat('Y-m-d', $date);
} catch (InvalidFormatException $e) { } catch (InvalidFormatException $e) {
$validator->errors()->add('date', 'Invalid date info'); $validator->errors()->add('date', trans('validation.date',['attribute' => 'date']));
return; return;
} }
if (!is_numeric($rate)) { if (!is_numeric($rate)) {
$validator->errors()->add('rate', 'Rate must be a number.'); $validator->errors()->add('rate', trans('validation.number',['attribute' => 'rate']));
return; return;
} }
} }

View File

@@ -74,12 +74,12 @@ class StoreByDateRequest extends FormRequest
} }
foreach ($rates as $key => $entry) { foreach ($rates as $key => $entry) {
if ($key === $from->code) { if ($key === $from->code) {
$validator->errors()->add(sprintf('rates.%s', $key), sprintf('Cannot convert from "%s" to itself.', $key)); $validator->errors()->add(sprintf('rates.%s', $key), trans('validation.convert_to_itself', ['code' => $key]));
continue; continue;
} }
$to = TransactionCurrency::where('code', $key)->first(); $to = TransactionCurrency::where('code', $key)->first();
if (null === $to) { if (null === $to) {
$validator->errors()->add(sprintf('rates.%s', $key), sprintf('Invalid currency code "%s".', $key)); $validator->errors()->add(sprintf('rates.%s', $key), trans('validation.invalid_currency_code', ['code' => $key]));
} }
} }
}); });

View File

@@ -21,7 +21,6 @@
*/ */
declare(strict_types=1); declare(strict_types=1);
return [ return [
@@ -109,7 +108,6 @@ return [
'unique_account_for_user' => 'This account name is already in use.', 'unique_account_for_user' => 'This account name is already in use.',
'between.numeric' => 'The :attribute must be between :min and :max.', 'between.numeric' => 'The :attribute must be between :min and :max.',
'between.file' => 'The :attribute must be between :min and :max kilobytes.', 'between.file' => 'The :attribute must be between :min and :max kilobytes.',
'between.string' => 'The :attribute must be between :min and :max characters.', 'between.string' => 'The :attribute must be between :min and :max characters.',
@@ -141,6 +139,8 @@ return [
'min.array' => 'The :attribute must have at least :min items.', 'min.array' => 'The :attribute must have at least :min items.',
'not_in' => 'The selected :attribute is invalid.', 'not_in' => 'The selected :attribute is invalid.',
'numeric' => 'The :attribute must be a number.', 'numeric' => 'The :attribute must be a number.',
'convert_to_itself' => 'Cannot store currency exchange rate for ":code", because from and to currency are the same.',
'invalid_currency_code' => 'Currency code ":code" is invalid',
'scientific_notation' => 'The :attribute cannot use the scientific notation.', 'scientific_notation' => 'The :attribute cannot use the scientific notation.',
'numeric_primary' => 'The primary currency amount must be a number.', 'numeric_primary' => 'The primary currency amount must be a number.',
'numeric_destination' => 'The destination amount must be a number.', 'numeric_destination' => 'The destination amount must be a number.',
@@ -183,7 +183,6 @@ return [
'piggy_no_change_currency' => 'Because there are piggy banks linked to this account, you cannot change the currency of the account.', 'piggy_no_change_currency' => 'Because there are piggy banks linked to this account, you cannot change the currency of the account.',
'secure_password' => 'This is not a secure password. Please try again. For more information, visit https://bit.ly/FF3-password', 'secure_password' => 'This is not a secure password. Please try again. For more information, visit https://bit.ly/FF3-password',
'valid_recurrence_rep_type' => 'Invalid repetition type for recurring transactions.', 'valid_recurrence_rep_type' => 'Invalid repetition type for recurring transactions.',
'valid_recurrence_rep_moment' => 'Invalid repetition moment for this type of repetition.', 'valid_recurrence_rep_moment' => 'Invalid repetition moment for this type of repetition.',
@@ -246,7 +245,6 @@ return [
'deposit_dest_wrong_type' => 'The submitted destination account is not of the right type.', 'deposit_dest_wrong_type' => 'The submitted destination account is not of the right type.',
'transfer_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.', 'transfer_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.',
'transfer_source_bad_data' => '[c] Could not find a valid source account when searching for ID ":id" or name ":name".', 'transfer_source_bad_data' => '[c] Could not find a valid source account when searching for ID ":id" or name ":name".',
'transfer_dest_need_data' => '[c] Need to get a valid destination account ID and/or valid destination account name to continue.', 'transfer_dest_need_data' => '[c] Need to get a valid destination account ID and/or valid destination account name to continue.',