[wp-hackers] Improvements to the WordPress l10n framework

Omry Yadan omry at yadan.net
Mon May 14 05:02:47 GMT 2007


I updated the example to use a stack.

now each plugin registers two actions:

"some_action" and "another_action".

when the do-stuff.php file calls do_action("some_action"), each plugin
call do_action("another_action") from its own action callback.

the result seems to be working correctly.


http://trac.wordpress.org/ticket/4260



Nikolay Bachiyski wrote:

> 2007/5/13, Omry Yadan <omry at yadan.net>:
>> >
>> > Using a stack we can only reassure we are not in the wrong plugin.
>> > However we cannot intercept the switch between a plugin and the core.
>> > Here is an example:
>> > wp-content/plugins/our.php:
>> >    function f() {
>> >        ....
>> >        $x = comments_number();
>> >        ....
>> >    }
>> >
>> > In the comments_number function there are some i18n-ed strings and we
>> > expect their translations to be taken from the default domain. However
>> > the current context will point us to our plugin and the translation
>> > will be searched for in its domain, not in the default.
>> >
>> > In most of the cases we can solve this problem by searching not only
>> > in the plugin namespace, but on failure -- also in the default one. Of
>> > course, this will work only if we are sure that one string has the
>> > same translation everywhere.
>>
>>
>> Well, I can claim this is a feature that allow plugins to override core
>> translations in while their context. :)
>
> I still don't think it is the Right Thing To Do (tm), however it could
> prove sufficient for our needs.
>
> You could start a ticket and put the code there, so that we don't
> forget about it :-)
>
> Happy hacking,
> Nikolay.
> _______________________________________________
> 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