[wp-trac] [WordPress Trac] #6725: $page_hook should not be translated in localized wordpress versions

WordPress Trac wp-trac at lists.automattic.com
Mon Apr 14 20:30:40 GMT 2008


#6725: $page_hook should not be translated in localized wordpress versions
----------------------------+-----------------------------------------------
 Reporter:  whoismanu       |       Owner:  anonymous                                             
     Type:  defect          |      Status:  new                                                   
 Priority:  normal          |   Milestone:  2.7                                                   
Component:  Administration  |     Version:  2.5                                                   
 Severity:  normal          |    Keywords:  page_hook localization translation admin_print_scripts
----------------------------+-----------------------------------------------
 localized version of wordpress like e.g. the french one that can be
 obtained at http://fr.wordpress.org/ translate page hooks.
 to me this is bad practice because non localized plugins which use page
 hooks will no longer work with these localized versions of wordpress (even
 though they work perfectly fine with the english one).

 example:

 my plugin used the admin_print_scripts-page_hook hook like this:


 {{{
 add_action('admin_print_scripts-manage_page_whoismanu-photoq',
 array(&$this,'addHeaderCode'), 1);
 }}}

 this works perfectly fine on the english wp. on the french version however
 the same page hook is translated to gerer_page_whoismanu-photoq and to
 work the hook in my plugin would have to be


 {{{
 add_action('admin_print_scripts-gerer_page_whoismanu-photoq',
 array(&$this,'addHeaderCode'), 1);
 }}}

 this translation is done in fr_FR.po on lines 4642-4646:


 {{{
 #: wp-admin/menu.php:17
 #: wp-admin/menu.php:19
 #: wp-admin/menu.php:21
 msgid "Manage"
 msgstr "Gérer"

 }}}

 to see that this what happens, just install the french version of wp and

 {{{
 echo "page hook: " . $page_hook;
 }}}


 in admin-header.php.



 now, i cannot account for all possible translations in my plugin so i
 guess the page hooks should not be translated but be unique. otherwise the
 admin_print_scripts-page_hook function seems to be quite useless as
 already stated here: [http://trac.wordpress.org/ticket/4563] (this ticket
 was quite old and closed and seems to describe the same problem. so not
 sure whether it was never fixed or whether it just resurfaced. as it was
 closed and old, i.e., not recently opened and closed as the guidelines
 state, i didn't post there but made a new ticket. sorry if this wasn't the
 approach to take).

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6725>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list