flarum / framework

Simple forum software for building great communities.
http://flarum.org/
6.27k stars 826 forks source link

Some email notifications are forced into English #1934

Closed Pherinos closed 3 years ago

Pherinos commented 4 years ago

Bug Report

I have identified some PHP files where the text is not translatable because forced into English in the code.

Files

 66     /**
 67      * {@inheritdoc}
 68      */
 69     public function getEmailSubject()
 70     {
 71         return '[New Post] '.$this->post->discussion->title;
 72     }
64     /**
 65      * {@inheritdoc}
 66      */
 67     public function getEmailSubject()
 68     {
 69         return "{$this->post->user->display_name} mentioned you in {$this->post->discussion->title}";
 70     }
 72     /**
 73      * {@inheritdoc}
 74      */
 75     public function getEmailSubject()
 76     {
 77         return "{$this->reply->user->display_name} replied to your post in {$this->post->discussion->title}";
 78     }

Environment

Flarum core 0.1.0-beta.10
PHP version: 7.3.11
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, bz2, calendar, ctype, hash, filter, ftp, gettext, gmp, SPL, iconv, pcntl, readline, Reflection, session, standard, SimpleXML, sockets, mbstring, tokenizer, xml, mysqlnd, bcmath, curl, dba, dom, enchant, fileinfo, gd, imagick, imap, intl, json, ldap, exif, mysqli, odbc, PDO, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, redis, soap, sodium, sqlite3, sysvmsg, sysvsem, sysvshm, tidy, xmlreader, xmlrpc, xmlwriter, xsl, zip, ionCube Loader, Zend OPcache
+---------------------------------+-----------------+--------+
| Flarum Extensions               |                 |        |
+---------------------------------+-----------------+--------+
| ID                              | Version         | Commit |
+---------------------------------+-----------------+--------+
| flarum-lang-english             | v0.1.0-beta.10  |        |
| flarum-flags                    | v0.1.0-beta.9   |        |
| flarum-likes                    | v0.1.0-beta.9   |        |
| flarum-lock                     | v0.1.0-beta.9   |        |
| flarum-mentions                 | v0.1.0-beta.10  |        |
| flarum-statistics               | v0.1.0-beta.9   |        |
| flarum-sticky                   | v0.1.0-beta.9   |        |
| flarum-subscriptions            | v0.1.0-beta.9   |        |
| flarum-suspend                  | v0.1.0-beta.9   |        |
| flarum-tags                     | v0.1.0-beta.10  |        |
| fof-pages                       | 0.2.7           |        |
| fof-links                       | 0.2.1           |        |
| fof-follow-tags                 | 0.3.4           |        |
| fof-masquerade                  | 0.3.3           |        |
| fof-ban-ips                     | 0.1.5           |        |
| fof-stopforumspam               | 0.2.0           |        |
| fof-ignore-users                | 0.1.4           |        |
| fof-user-directory              | 0.3.3           |        |
| fof-disposable-emails           | 0.1.0           |        |
| fof-username-request            | 0.2.0           |        |
| fof-pretty-mail                 | 0.1.6           |        |
| flarum-emoji                    | v0.1.0-beta.10  |        |
| clarkwinkelmann-emojionearea    | 0.2.0           |        |
| fof-custom-footer               | 0.1.3           |        |
| noriods-auto-more               | 0.3.0           |        |
| fof-socialprofile               | 0.1.1           |        |
| michaelbelgium-discussion-views | v0.1.0-beta.8.3 |        |
| fof-byobu                       | 0.3.4           |        |
| matteocontrini-imgur-upload     | v3.3.0          |        |
| fof-nightmode                   | 0.3.0           |        |
| fof-spamblock                   | 0.2.1           |        |
| fof-terms                       | 0.4.0           |        |
| fof-frontpage                   | 0.1.3           |        |
| fof-polls                       | 0.1.1           |        |
| reflar-doorman                  | 0.1.4           |        |
| fof-split                       | 0.4.3           |        |
| fof-merge-discussions           | 0.3.3           |        |
| fof-subscribed                  | 0.2.3           |        |
| fajuu-contactbutton             | v3.0            |        |
| flagrow-direct-links            | 0.2.0           |        |
| flagrow-ads                     | 0.2.4           |        |
| v17development-seo              | 1.0.2           |        |
| jordanjay29-summaries           | 0.3.1           |        |
| fof-drafts                      | 0.1.3           |        |
| fof-linguist                    | 0.4.1           |        |
| milescellar-lang-french         | v1.4.1          |        |
| flarum-markdown                 | v0.1.0-beta.10  |        |
| flarum-bbcode                   | v0.1.0-beta.8   |        |
| rooaaar-lang-french-extended    | v1.14.0         |        |
| fof-bbcode-details              | 0.1.0           |        |
| ericychu-bbcode-editor          | v0.1.0-beta.7.3 |        |
| kvothe-spoiler-bbcode           | 0.1.0           |        |
| flagrow-upload                  | 0.7.1           |        |
| antoinefr-online                | 0.4.0           |        |
+---------------------------------+-----------------+--------+
Base URL: https://latoilemysterieuse.a2co.org
Installation path: /var/www/vhosts/a2co.org/subdomains/latoilemysterieuse.a2co.org
Debug mode: off

Additional Context

All languages translations

matteocontrini commented 4 years ago

Related: flarum/issue-archive#426, flarum/framework#537.

Those emails are not translated because their content is rendered through Blade templates. And Blade will be required in the long run to have HTML emails.

As a workaround, you can fork the mentions and subscriptions extension to edit the templates as you wish.

Pherinos commented 4 years ago

OK, thank you for the answer. I'll look at them.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We do this to keep the amount of open issues to a manageable minimum. In any case, thanks for taking an interest in this software and contributing by opening the issue in the first place!

rob006 commented 4 years ago

Bump.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We do this to keep the amount of open issues to a manageable minimum. In any case, thanks for taking an interest in this software and contributing by opening the issue in the first place!

rob006 commented 4 years ago

Bump.

askvortsov1 commented 4 years ago

2 potential ways of going about this:

  1. Getting the translator instance into the view. I'm not that familiar with how laravel handles views, but can look into options.
  2. Have each translation conditionally override views if the locale in question is enabled. A similar thing is discussed here: https://github.com/flarum/core/pull/2134 but option 1 sounds cleaner tbh
askvortsov1 commented 4 years ago

Now that flarum/framework#2169 has been merged, the only thing that remains is putting all the english text / links in emails for core and bundled extensions through the translator