Send Differential e-mails in user's language

Summary:
Works this way:

- Select users' language with multiplexing.
- Select default language otherwise (it can be different from current user's language).
- Build body and subject for each user individually.
- Set the original language after sending the mails.

Test Plan:
- Comment on a diff of user with custom translation.
- Set default to a custom translation. Comment on a diff of user with default translation.
- Set default to a default translation. Comment on a diff of user with default translation.

Repeat with/without multiplexing.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1139

Differential Revision: https://secure.phabricator.com/D2774
This commit is contained in:
vrana
2012-06-15 23:21:25 -07:00
parent 112acf11cf
commit e84f9f9ec9
7 changed files with 165 additions and 57 deletions

View File

@@ -62,9 +62,7 @@ abstract class PhabricatorController extends AphrontController {
$translation = $user->getTranslation();
if ($translation &&
$translation != PhabricatorEnv::getEnvConfig('translation.provider') &&
class_exists($translation) &&
is_subclass_of($translation, 'PhabricatorTranslation')) {
$translation != PhabricatorEnv::getEnvConfig('translation.provider')) {
$translation = newv($translation, array());
PhutilTranslator::getInstance()
->setLanguage($translation->getLanguage())