[Resolved] [Plugin: Email Alerts] Problems with localization? Look here for a fix…
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)
$locale = get_locale (); if ( empty($locale) ) $locale = 'en_US'; $mofile = dirname (__FILE__)."/locale/$locale.mo"; load_textdomain ($this->plugin_name, $mofile);
load_plugin_textdomain($this->plugin_name, false, basename( dirname( __FILE__ ) ) . '/locale/');
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:
_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:
- The topic ‘[Resolved] [Plugin: Email Alerts] Problems with localization? Look here for a fix…’ is closed to new replies.