Q&A: Dictionary, Settings, multiple files
I was wondering what the policy was when developing extensions and providing localizations for those extensions.
Right now, I evaluate the Dictionary entry at the top of my Extension, and if it isn't present, I define it. This means that basically the Extension holds the Dictionary entries for itself. It doesn't seem right, though. Is there another approach for this?I'm making an Extension that requires its own Settings page for the forum administrators. Where do I save these settings? Should I make a separate settings.php file or is there a way to register some new settings variables with the Vanilla framework? Which brings me to the following...
I have a few Extensions that consist of various files (some php, some swf, etc.). I was thinking that it would be nice to have a folder for each extension. So that is what I did. I created a folder, named exactly like my Extension's PHP file, but without the PHP extension. This works well and keeps everything inside of the Extensions folder. Does this seem logical or is there a better way of dealing with it?
Comments
It indeed doesn't seem right to have multiple files, but in the same way it doesn't seem right to have a bunch of strings for each and every possible Vanilla Extension in the dictionary file. Or does it?
That would basically mean that to release an Extension that requires Dictionary entries, one would have to send the finished Extension to Mark along with the Dictionary entries in a separate file, which Mark would then have to add to the Dictionary file of the next Vanilla release. That would also make the Extension require that version of Vanilla at least, and just for the sake of a few Dictionary entries.
Tricky, that. Or maybe I'm overlooking something that would make this all very simple.
However, I have no idea how this would impact speed and scalability of Vanilla. Although with naming conventions for the settings files and Dictionary files, there would not have to be any directory listing behind the scenes. All the filenames would be known and would just have to be called.
Right now, I evaluate the Dictionary entry at the top of my Extension, and if it isn't present, I define it. This means that basically the Extension holds the Dictionary entries for itself. It doesn't seem right, though. Is there another approach for this?
The best solution I could come up with, and I'm still open to suggestions, is to just include a readme with the extension that outlines what your new dictionary entries are, and the user can then go into their own language dictionary to add them. Perhaps in the future mini's dictionary manager will be bundled with vanilla, allowing them to do this. I also thought that it might be a good idea for your new dictionary codes to be prefixed with your extension name so that they are easily identified as an extension definition, like: Clipboard_Title where the prefix is "Clipboard_" and you'd know it's the clipboard extension.
I'm making an Extension that requires its own Settings page for the forum administrators. Where do I save these settings? Should I make a separate settings.php file or is there a way to register some new settings variables with the Vanilla framework?
The next rev's configuration settings are going to be in an associative array called $Configuration. So, as of Vanilla 0.9.3, you'll be able to add as many global configuration settings as you want via your extension. For the time being, I'd just create a $Configuration = array(); variable and put it in your own settings.php file with whatever name/value definitions you need. When 0.9.3 comes out, you should be able to easily change your code to jive with the new configuration array, then.
I have a few Extensions that consist of various files (some php, some swf, etc.). I was thinking that it would be nice to have a folder for each extension. So that is what I did. I created a folder, named exactly like my Extension's PHP file, but without the PHP extension. This works well and keeps everything inside of the Extensions folder. Does this seem logical or is there a better way of dealing with it?
What you did is exactly what I'm recommending. I think that there will be a LOT of extensions that only require a single file, so a single file in the extensions directory is the way to go. If you have any extra files that you want to use in your extension, they should go into a folder with the same name as your extension.
Note: I'm getting close to finishing the documentation. The cherry on the "extension documentation" cake is going to be a "getting started" doc that outlines where to go to get inforamtion about various things, and completely spells out guidelines for all of the questions listed here as well as naming conventions to use, etc.