Skip to content

[3.0] Writes each digest in the language of the member receiving it - #9613

Open
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/digest-member-language
Open

[3.0] Writes each digest in the language of the member receiving it#9613
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/digest-member-language

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

SendDigests collects the strings for every language its subscribers read into $langtxt, keyed by language, and then builds every email from $langtxt[$lang]$lang being whatever the foreach ($langs as $lang) that filled $langtxt happened to leave behind. Every member gets the same language, whichever one sorted last, and the 'lang' the opening query records for each member is never read at all.

The sign-off did not even do that. It called Lang::getTxt('regards_team', …) with no language argument, so it was always in the forum's default language while the rest of the mail was in another. There is already a correctly localized copy of it in $langtxt[…]['bye'], which nothing used.

Verified on the Docker stack with a marked second language pack: with UserA on tr_TR and UserB on en_US, both digests came out identical before, and afterwards each member's mail — subject, intro, section headings, lines and sign-off — is in their own language.

Note that this is only visible once #9612 lands. Lang::load() currently ignores the language it is asked for, so Lang::getTxt(…, lang: …) returns the forum default whatever it is passed, and the two changes were verified together.

Not covered by a test. SendDigests::execute() opens with a query and needs a database throughout, so it is out of scope for the unit suite.

Issues References (Fixes|Related|Closes)

  1. Related: [3.0 & 2.1]: Empty daily digest emails getting sent; Folks who have not opted-in to email are receiving digests; Emails in wrong language #9609 — one of the three problems reported there.
  2. Related: [3.0] Loads the language a caller asked for instead of the forum default #9612, without which the effect of this change cannot be seen.

🤖 Generated with Claude Code

The strings for every language a subscriber reads are collected into $langtxt,
keyed by language, and then every email was built from $langtxt[$lang] - $lang
being whatever the foreach that filled $langtxt left behind. Every member got
the same language, whichever one happened to be last, and the 'lang' the query
recorded for each member was never read.

The sign-off did not even do that: it called getTxt() with no language at all,
so it was always in the forum's default language while the rest of the mail
was in another. There is already a localized copy of it in $langtxt['bye'],
which nothing used.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant