[wp-hackers] Decision time in re: admin rework

Edward Dale scompt at scompt.com
Sun Dec 23 14:04:13 GMT 2007


I was going to make a plugin to allow simpler customization of Howdy,
for example, random greetings from around the world.  I haven't gotten
around to that part though.  I did come up with a code snippet that
changes the text without having to deal with .PO files, etc.  I
haven't tested it in a while, but here it is:

add_action('admin_head', 'scompt_add_gettext');
function scompt_add_gettext() {
    add_filter( 'gettext', 'scompt_gettext', 10, 2);
}
function scompt_gettext($translated, $text) {
    if( $text == 'Howdy, <strong>%s</strong>.' ) {
        remove_filter('gettext', 'scompt_gettext', 10, 2);
        return "woohoo, <strong>%s</strong>";
    }
    return $translated;
}

The scompt_gettext filter is added in the admin_head action and
removed after being used once to keep the work performed to a minimum.

Toss it in your functions.php, say goodbye to Howdy.

Ed

On Dec 23, 2007 2:44 PM, Alex Hempton-Smith <hempsworth at googlemail.com> wrote:
> Hmm, so why are people complaining?
> Let's get back on topic! :P
>
>
> On Dec 23, 2007 1:35 PM, Ozh <ozh at planetozh.com> wrote:
>
> > It's printf(__('Howdy, <strong>%s</strong>.') so yes, it's translated.
> >
> > On Dec 23, 2007 2:33 PM, Alex Hempton-Smith <hempsworth at googlemail.com>
> > wrote:
> > > Regarding the 'Howdy' complaints people are having, perhaps the best
> > > compromise would be to provide a hook to allow for localization.
> > >
> > > Also, does 'Howdy' change with each different language anyway? So,
> > 'Bonjour'
> > > instead of 'Howdy' in the French translation. Or is it 'Howdy' for
> > everyone?
> >
> > --
> > http://FrenchFragFactory.net ~ Daily Quake News
> > http://planetOzh.com ~ Blog and WordPress Stuff
> > _______________________________________________
> > 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
>
>


More information about the wp-hackers mailing list