https://bugzilla.wikimedia.org/show_bug.cgi?id=46851

--- Comment #4 from PleaseStand <[email protected]> ---
This could be further extended by allowing use of closures.

Simple example (using a helper function textCB()):

wfMessage( 'foo',  wfMessage( 'bar', 'foo' )->textCB() )->inLanguage( 'en_CA'
);

More complex example:

$tsHTML = function ( $ctx ) use ( $ts ) {
    return Html::element( 'span',
        array( 'title' => wfTimestamp( TS_ISO_8601, $ts ) ),
            $ctx->getLanguage()->timeanddate( $ts ),
        );
    );
};

wfMessage( 'bar' )->rawParams( $tsHTML )->inLanguage( 'en_CA' );

where MessageContext $ctx would only implement msg(), getLanguage(),
getContentLanguage(), and getTitle(), to ensure that all relevant information
is actually included in the Message object being passed around.

Unfortunately, my specific case (the one I discussed with Daniel Friesen on
IRC) requires $ctx->getRequest()->getIP(); however, this may come in handy
elsewhere.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to