...but I just had a wicked idea. And this is like da bomb because it solves an awful lot of headaches very quickly.
For most plugins, they'll have their language files and keep them to themselves like good little plugins. But some plugins are not so well behaved because they'll need to load language files in other contexts. Probably the biggest example is menu items.
Now, I want to have a menu editor function in the core - some day - but the biggest problem is handling language items and doubly so for plugins. How can we have them around and loaded, and still do it efficiently?
And it occurred to me... no, I don't mean reinstating that shitfest Modifications.language.php, that shit can remain dead and buried. No, what I had in mind was far more elegant.
Menu items are needed every page, right? That means, essentially, wherever loadLanguage('index') is called, the menu items are needed. So why not have some facility whereby a plugin's language strings can be injected into the database? Obviously I wouldn't be expecting language files to do their own DB inserts, but I'd probably have a facility in the plugin-info.xml that says to load a given language and append it to an existing set of entries. That way if a plugin wants to add a new menu item, it just has to add its language file correctly, the plugin manager kicks it into the DB, recaches etc. and then it's available without having to load an extra file.
Then the menu editor just becomes some juggling of arrays and cache items, plus any other plugin that wants language strings 'everywhere' can just append them where it needs them if that makes sense.
If it doesn't, just prod me in the morning and I'll see if it still makes sense :D
For most plugins, they'll have their language files and keep them to themselves like good little plugins. But some plugins are not so well behaved because they'll need to load language files in other contexts. Probably the biggest example is menu items.
Now, I want to have a menu editor function in the core - some day - but the biggest problem is handling language items and doubly so for plugins. How can we have them around and loaded, and still do it efficiently?
And it occurred to me... no, I don't mean reinstating that shitfest Modifications.language.php, that shit can remain dead and buried. No, what I had in mind was far more elegant.
Menu items are needed every page, right? That means, essentially, wherever loadLanguage('index') is called, the menu items are needed. So why not have some facility whereby a plugin's language strings can be injected into the database? Obviously I wouldn't be expecting language files to do their own DB inserts, but I'd probably have a facility in the plugin-info.xml that says to load a given language and append it to an existing set of entries. That way if a plugin wants to add a new menu item, it just has to add its language file correctly, the plugin manager kicks it into the DB, recaches etc. and then it's available without having to load an extra file.
Then the menu editor just becomes some juggling of arrays and cache items, plus any other plugin that wants language strings 'everywhere' can just append them where it needs them if that makes sense.
If it doesn't, just prod me in the morning and I'll see if it still makes sense :D