Support » Plugin: Email Alerts » [Plugin: Email Alerts] Problems with localization? Look here for a fix…

  • Resolved alundstroem



    I installed this plugin, and think it’s quite awesome (: the POT-file enabled me to use POEdit (tutorials on how to do the translation: here and here) and translate the plugin to my native language, Swedish, but my translation didn’t get picked up by the plugin… there was a support issue on this since a year ago, I don’t know if the issue was resolved or not in some previous release but as I installed the latest release and it didn’t work – I assume it broken.

    My fix (all dir’s/file’s are from the plugin, just altered them a bit)

    %email-alerts dir%/plugin.php:


    $locale = get_locale ();
    if ( empty($locale) )
      $locale = 'en_US';
    $mofile = dirname (__FILE__)."/locale/$";
    load_textdomain ($this->plugin_name, $mofile);


    load_plugin_textdomain($this->plugin_name, false, basename( dirname( __FILE__ ) ) . '/locale/');

    %email-alerts dir%/view/admin/*.*:

    make sure that every




    call have the correct number of parameters, see the codex.

    To fetch a string simply use __(‘String name’,’your-unique-name’); to return the translation or _e(‘String name’,’your-unique-name’); to echo the translation.

    Seems like (some) of the __() and _e() used to fetch translations either lack the second parameter or it is faulty, examples below…

    missing the second parameter (the plugins registered name from load_plugin_textdomain):


    faulty second parameter:
    _e( 'Comment notifications', 'swea' )

    alter all the __() and _e() to match:
    __('Notifications', 'email-alerts')>
    _e( 'Comment notifications', 'email-alerts' )

    After that, place your .po and .mo in the %%/locale dir… name them something like, for example in my case:


Viewing 1 replies (of 1 total)
  • I’ve found and fixed those problems too, adding italian translation. Furthermore there was a deprecated function call in the plugin: update_usermeta (deprcated in favour of update_user_meta).

    I’m going to contac the plugin author to see if he could add those fixes in a new release. It works great with WP 3.4.1

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Email Alerts] Problems with localization? Look here for a fix…’ is closed to new replies.