WordPress.org

Ready to get started?Download WordPress

Forums

Email Alerts
[resolved] Problems with localization? Look here for a fix... (2 posts)

  1. alundstroem
    Member
    Posted 2 years ago #

    Hi,

    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:

    change

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

    to

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

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

    make sure that every

    __()

    and

    _e()

    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):
    __('Notifications')

    or

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

    alter all the __() and _e() to match:
    __('Notifications', 'email-alerts')>
    or
    _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:
    email-alerts-sv_SE.mo
    email-alerts-sv_SE.po

    Enjoy

    http://wordpress.org/extend/plugins/email-alerts/

  2. Daniele Raimondi
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.