I like it, especially the "messages in sets" thing. Though there should be a smart way to avoid loading the same set more than once. Perhaps a static factory class which manages one instance per set name.
The magic properties also arn't bad, though I kind of like the chaining thing... $msgSet->parse( 'test-number', 4 ) isn't so nice, it would be much nicer to have $msgSet->test_number->parameters( 4 )->escape() etc. That would however mean that the magic properties wouldn't be strings, but objects themselves. not sure if that's good for performance... just some thoughts -- daniel Trevor Parscal schrieb: > I have been experimenting with a very different approach to this problem > which essentially goes like this... > > // Provide a source for a message set at start-up time, this opens up other > message sources in the future > MessageCache::bind( 'myMessages', new MessageFile( 'i18n/myMessages.php' ) ); > > // Get a message set object for that set > $msgSet = new MessageSet( 'myMessages' ); > > // Use messages as *magic* properties of the object > echo "$msgSet->name says $msgSet->test"; > > // Use a message, passing in parameters > echo $msgSet->parse( 'test-number', 4 ); > > I have some basic code for this, but I'm mostly just suggesting it as an > alternative to using a static class like this. I think the other thing > this implies is something that would be beneficial to MediaWiki - > putting messages is sets (similar to gettext's domains). Anyways, just > my 2 cents. > > - Trevor > > _______________________________________________ > Wikitech-l mailing list > [email protected] > https://lists.wikimedia.org/mailman/listinfo/wikitech-l _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
