Skip to content

fix(i18n): refund messages, payment rows and the activity log read in the right language (#455) - #470

Merged
Panelica merged 1 commit into
Panelica:mainfrom
ertugrulkeyvan:fix/refund-and-log-texts-localised
Nov 18, 2026
Merged

Panelica merged 1 commit into
Panelica:mainfrom
ertugrulkeyvan:fix/refund-and-log-texts-localised

Conversation

@ertugrulkeyvan

Copy link
Copy Markdown
Contributor

Fixes #455.

What was wrong

  • Refunding from the admin invoice page answered Refund of 50.00 processed. in English whatever the admin's language. Every message PaymentService::refundInvoice() returns, including the refusals ("Nothing has been paid on this invoice.", "Refund amount exceeds…", the gateway errors), was a fixed English string.
  • The rows written to the customer's history were English too: Payment for Invoice #… and Refund for Invoice #… on transactions (PaymentService and TransactionService), and Refund of invoice #… — balance returned / funds returned, Funds added via invoice #… and Payment for several invoices via #… on the credit log.
  • The activity log named an invoice by invoices.id (Invoice #85 paid) in LogActivityListener and five places in Admin\InvoiceController, while every screen and document shows the invoice number.

What changes

  • The refund messages are admin.invoices.refund_* keys, so they follow the admin's language.
  • The payment, refund and credit descriptions are client.invoices.* keys written in the customer's language, not the language of whoever happens to be signed in when the row is made: a German customer's history reads German even when a Turkish admin refunds. This is how the proforma reference on the VAT invoice is already written (ProformaService::withProformaReference). The choice lives in one place, Client::recordLocale(): the customer's language, else DefaultLanguage.
  • The activity log entries for invoices use invoice_num. ActivityLogTest asserted the id and now asserts the number.

The new keys are in English and the four complete languages (tr, de, pl, zh), plus es, it, ru and uk, which have the files.

Left for you to decide

The activity log itself stays English. It has 53 ActivityLog::log() calls, none translated, and its rows are stored text: translating them when they are written would freeze each row in the language of whoever triggered it, and a log read by several admins would end up in several languages. Translating it properly means storing a key and its parameters and rendering them when the log is shown. That is a change to the table and to every caller, so I did not fold it into this fix. Happy to do it as a follow-up if you want it.

Tests

tests/Feature/RefundTextsLanguageTest.php (7 tests): the refund success and refusal messages in the admin's language over HTTP, the payment and refund transactions in the customer's language while the app runs in another, the shop default when the customer has none recorded, the balance-returned and funds-added credit rows, and the activity log naming the invoice by its number. All 7 fail on main and pass here.

Full suite: 5433 passed, 3 skipped, 2 failed. The two failures (CurrencyAndBackupTest, MailLinkHostTest) fail the same way on main in my environment.

@Panelica
Panelica merged commit e413cce into Panelica:main Nov 18, 2026
1 check passed
Panelica pushed a commit that referenced this pull request Nov 18, 2026
#470 ile gelen recordLocale(), billingEmail()'in aciklamasini kendi
uzerine almisti; iki yorum ust uste duruyordu ve billingEmail
aciklamasiz kaliyordu. Yorumlar ait olduklari islevlere donduruldu,
davranis degismedi.
@Panelica

Copy link
Copy Markdown
Owner

Merged, thank you. The reasoning is the part I like: the admin's messages follow the admin, and what is kept on the customer's own records is written in the customer's language.

All 7 tests red on 1.29.0, green after. Measured on the merge result: the full suite is green — 5463 passed in parallel (--exclude-group=serial, 4 processes) plus the 17 serial installer tests, 5 skipped, 0 failed.

Two small things:

  • I moved one comment in a follow-up commit (fdfd23a): recordLocale() landed between billingEmail()'s docblock and billingEmail(), so that block was documenting the wrong method. Behaviour untouched.
  • invoices.language records the language a document was issued in. For a line about an invoice that may be the better source than the client's current choice — a refund on a German invoice would then read German even after the customer switches to English. Worth a thought; what is merged is already a long way from English-only.

@Panelica

Copy link
Copy Markdown
Owner

Released in 1.30.0, the stable channel, offered to every installation.

Gates on the tag and that package: full suite 5463 passed in parallel plus the 17 serial installer tests (0 failed, 5 skipped); 276 translation and parity tests green; the update lab 14 scenarios ALL GREEN; the real package updated the last stable (1.29.0 → 1.30.0, 13 checks) and the last beta (1.25.1-beta.1 → 1.30.0, 14 checks), each installed from its published package in the published runtime image with the signature checked by the key built into the application; the three uploaded assets re-downloaded and compared byte for byte before publishing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Refund message, activity log entries and transaction descriptions are hard-coded English, and the log uses the internal invoice id

2 participants