Fork me on GitHub
Subscribe 3

Ticket #503 (fixed task)

Convert mail templates to new language system

  • Created: 2011-10-04 01:25:18
  • Reported by: Franz
  • Assigned to: Franz
  • Milestone: 2.0-alpha2
  • Component: localization
  • Priority: normal

We have to decide how we are going to handle mail templates with the new language system. I don't know how this is usually done when Gettext is used.


Franz 2011-11-24 22:59:03

  • Owner set to Franz.

daris 2011-12-03 08:04:47

Here is how it's done in Wordpress:

#: wp-activate.php:66
msgid "Your account has been activated. You may now <a href=\"%1$s\">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;.  Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href=\"%4$s\">reset your password</a>."
msgstr "Twoje konto zostało aktywowane. Możesz teraz <a href=\"%1$s\">zalogować się</a> do witryny przy użyciu wybranej nazwy użytkownika (&#8222;%2$s&#8221;). Hasło i instrukcje dotyczące logowania się zostały wysłane na adres %3$s. Jeśli nie umiesz znaleźć wspomnianego e-maila w swojej skrzynce odbiorczej, sprawdź folder &#8222;Niechciane&#8221; lub &#8222;Spam&#8221;. Jeżeli wiadomość nie znajduje się w tych folderach i nie otrzymasz jej w ciągu następnej godziny, możesz <a href=\"%4$s\">wygenerować nowe hasło</a>."

So it's using a simple sprintf() call. There is also other method used in Wordpress which is something like FluxBB now have:

#: wp-includes/ms-functions.php:1307
msgid ""
"Dear User,\n"
"Your new SITE_NAME site has been successfully set up at:\n"
"You can log in to the administrator account with the following information:\n"
"Username: USERNAME\n"
"Password: PASSWORD\n"
"Log in here: BLOG_URLwp-login.php\n"
"We hope you enjoy your new site. Thanks!\n"
"--The Team @ SITE_NAME"
msgstr ""
"Drogi Użytkowniku,\n"
"Twoja nowa witryna w sieci SITE_NAME została utworzona pod adresem\n"
"Możesz zalogować się jako jej administrator przy użyciu następujących danych:\n"
"Nazwa użytkownika: USERNAME\n"
"Hasło: PASSWORD\n"
"Adres ekranu logowania się: BLOG_URLwp-login.php\n"
"Mamy nadzieję, że Twoja nowa witryna Ci się podoba. Dzięki!\n"
"--Zespół sieci \"SITE_NAME\""

All those strings are saved in .po files

FSX 2012-01-08 22:27:40

  • Owner changed from Franz to FSX.

Franz 2012-07-07 19:36:52

  • Milestone changed from 2.0-alpha1 to 2.0-alpha2.

Okay, we probably won't be using Gettext now.

I sent an email to the creator of Laravel yesterday with some suggestions for improvements to their localization class. We'll see what happens...

Franz 2013-01-06 22:30:25

  • Owner changed from FSX to Franz.

Woot woot, illuminate/mail supports Blade views. And I know how to make them change depending on language. Oh yeah!

Franz 2013-01-06 22:59:02

Commit 6a40622 to core master

#503: Add a view namespace for easy access to localized email templates.

Franz 2013-01-06 23:36:56

Commit 31a2eca to core master

#503: Add template for user registration welcome email.

Franz 2013-01-06 23:37:06

  • Status changed from open to fixed.

Done. I also added a welcome email after registration as an example.