Repository navigation
fix(i18n): refund messages, payment rows and the activity log read in the right language (#455) - #470
Conversation
…reader's language (Panelica#455)
#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.
|
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 ( Two small things:
|
|
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. |
Fixes #455.
What was wrong
Refund of 50.00 processed.in English whatever the admin's language. Every messagePaymentService::refundInvoice()returns, including the refusals ("Nothing has been paid on this invoice.", "Refund amount exceeds…", the gateway errors), was a fixed English string.Payment for Invoice #…andRefund for Invoice #…on transactions (PaymentServiceandTransactionService), andRefund of invoice #… — balance returned / funds returned,Funds added via invoice #…andPayment for several invoices via #…on the credit log.invoices.id(Invoice #85 paid) inLogActivityListenerand five places inAdmin\InvoiceController, while every screen and document shows the invoice number.What changes
admin.invoices.refund_*keys, so they follow the admin's language.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'slanguage, elseDefaultLanguage.invoice_num.ActivityLogTestasserted 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 onmainand pass here.Full suite: 5433 passed, 3 skipped, 2 failed. The two failures (
CurrencyAndBackupTest,MailLinkHostTest) fail the same way onmainin my environment.