[wp-hackers] Actions dependent on locale cannot be loaded in a plugin

Henrik Melin henrikmelin at yahoo.com
Wed Apr 2 01:26:26 GMT 2008


Yeh, I agree, it is confusing with locale dependent actions - the existence of which is easily overlooked when developing plugins on an English WP installation. I was tearing my hair out trying to figure out why the JS was absent on a sv_SE (Swedish) installation. 

Thanks for the help - that worked! And for completion, the action is:

add_action('load-' . sanitize_title(__('Settings')) . '_page_more-fields', 'mf_queue_js')

and nothing else.

Cheers,
Henrik.

----- Original Message ----
From: DD32 <wordpress at dd32.id.au>
To: wp-hackers at lists.automattic.com
Sent: Tuesday, April 1, 2008 5:36:05 PM
Subject: Re: [wp-hackers] Actions dependent on locale cannot be loaded in a plugin

If hooks are being run with translated names, It seems pretty stupid IMHO.

However, If you want to make sure the textdomain has been loaded at the  
time, Try adding your actions on the init hook, I think that runs after  
the translatable stuff has been loaded and setup.

On Wed, 02 Apr 2008 11:23:30 +1100, Henrik Melin <henrikmelin at yahoo.com>  
wrote:

> Hi!
>
>
> I've run into a problem when updating one of my plugins (More Fields).  
> The action:
>
>
> add_action('load-' . sanitize_title(__('Settings')) . '_more-fields',  
> 'mf_queue_js');
>
>
> changes depending on the locale, i.e. the translation of 'settings', but  
> when the plugin is loaded and the action is added, __('Settings') does  
> get translated, but remains 'Settings' and so I'm calling an action  
> which does not exist.
>
>
> I understand from http://trac.wordpress.org/ticket/4563 that this was  
> possible back in 2.2. Has the point at which the locale is loaded  
> changed?
>
>
> How can I access locale-dependent actions in my plugin?
>
>
> Any thoughts appreciated,
> Cheers,
> Henrik.
>
>
>
>
>       ____________________________________________________________________________________
> You rock. That's why Blockbuster's offering you one month of Blockbuster  
> Total Access, No Cost.
> http://tc.deals.yahoo.com/tc/blockbuster/text5.com
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers





      ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com


More information about the wp-hackers mailing list