API / Minn\Runtime / RecipientLocale

RecipientLocale final class

Minn\Runtime\RecipientLocale · public/minn/src/Minn/Runtime/RecipientLocale.php · 30 lines

An email written in its reader's language, as the reference writes each: the send run inside switch_to_user_locale for the account it goes to (the site's locale when the address belongs to none) and the locale restored after. The facade binds how a switch is made (WP_Locale_Switcher).

Constants and properties

privatestatic ?Closure $switcher

Public

staticbind(Closure $switcher): void#

How a switch is made (the facade's switch_to_user_locale and restore_previous_locale).

staticforUser(int $userId, Closure $send): mixed#

What a send answers, run in a user's language (the site's for 0).

staticforAddress(string $email, Closure $send): mixed#

What a send answers, run in the language of the account an address belongs to.

staticforSite(Closure $send): mixed#

What a send to the site's address (admin_email) answers, run in its account's language.