I wanted to share something that took me a while. I have discovered today Multilingual Variables. Hurray!
Actually, if you have i18n module installed, there's an easy way to translate OG mail templates. Here's how to for OG 2.0:
1) Edit your settings.php and add the $conf['i18n_variables'] array as described here: Multilingual Variables.
2) Append to the list of variables the following list:
// Organic Groups.
'og_new_node_subject',
'og_new_node_body',
'og_admin_email_subject',
'og_admin_email_body',
'og_approve_user_subject',
'og_approve_user_body',
'og_deny_user_subject',
'og_deny_user_body',
'og_invite_user_subject',
'og_invite_user_body',
'og_request_user_subject',
'og_request_user_body',
'og_new_admin_subject',
'og_new_admin_body',
3) Now, visit admin/og/og in any language to configure OG email templates for that language. ie. saving this page from es/admin/og/og will save your email templates in spanish version of OG variables. save from fr/admin/og/og to save them in french, and so on.
This could be obvious for some, but it took me a while. Maybe this could be documented in the OG readme? <--- feature request or task?
BTW, if you're looking for a way to translate mail templates in Notifications/Messaging, then take a look at #265680: Translation of email templates . Needs testing and feedback! :)
Comments
Comment #1
crea commentedSubscribing
Comment #2
span commentedPlease remove.
Comment #3
danny_joris commentedHi,
I've used this technique and I can translate the email messages, but the translations aren't actually used when sending emails to -say- a french user.
For invitation emails I managed to use the translated variable in the email using hook_mail_alter() , but for the other messages it didn't work. The other messages seem to be pre-generated by messages/notifications module, which add a header and footer to them.
Normally $message would contain the strings/values which I can use to replace @body and @description tokens with, but the $message variable of the emails that are modified by messages/notifications don't contain these strings/values...
How did this work for you, Markus? Did you use the messages & notifications modules?
Comment #4
claudiu.cristeaThis version of Drupal is not supported anymore. If this is still an issue in the
8.x-1.xbranch, please open a new up-to-date ticket. Closing.