Okay
  Public Ticket #2295838
Email template translations with WPML
Closed

Comments

  • phlegx started the conversation

    Hi,

    I’m not able to translate the Body content of email “Send reminds”. All other email strings appears on WPML String translation but not the body string of “Send reminds” (/wp-admin/admin.php?page=stec_menu__general&view=edit_email&template=send_event_remind_mail)

    I have tried to translate all strings with WPML. But if I’m on the calendar with website language e.g. German, the emails are send in english and don’t respect the actual website language or Wordpress (WPML) default language.

    Please support this features! Thx very much!

  •  780
    Zhivko replied

    Try implementing it via a filter.

    Example:

    In your theme functions.php file add:

    add_filter('stec_send_event_remind_mail', function($data) {
        
        if (!defined('ICL_LANGUAGE_CODE')) {
            return $data;
        }
        switch (ICL_LANGUAGE_CODE) {
            // Deutch
            case 'de':
                
                // google translated for example purpose...
                $data['subject'] = "Sie haben eine Erinnerung für die {{title}}";
                $data['content'] = "Sie haben eine Erinnerung für die {{title}}.\n\n" . "Veranstaltungsdatum: {{start_date}}.\n\n" . "Weitere Informationen finden Sie unter {{permalink}}.";
                break;
        
            // English and default values
            case 'en':
            default:
                $data['subject'] = "You have requested remind for {{title}}";
                $data['content'] = "You have requested remind for {{title}}.\n\n" . "Event date: {{start_date}}.\n\n" . "For more info visit {{permalink}}.";
        }
        return $data;
    });
    

    Stachethemes Developer

  • phlegx replied

    Thank you very much for your solution. But, why it is not possible to use already translated strings with the WPML String Translation tool? All this strings can be easy translated with the tool and the STEC filter should take this strings if WPML is installed? This is a clean solution and also other plugins that supports WPML solves this like proposed. What do you think?

  •  780
    Zhivko replied

    It has to do with the way the email content is stored to the settings. 

    I'll add fix for this in the next update.


    Stachethemes Developer

  • phlegx replied

    Thank you so much Zhivko! Happy to see this improvements in next release!