Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Q&A: Dictionary, Settings, multiple files

peapea New
edited August 2005 in Vanilla 1.0 Help
  1. 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?

  2. 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...

  3. 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

  • Options
    hi pea! I think mini is looking towards getting some sort of browser interface together for dictionary editing, if it has the ability to define new strings, you could add instructions for disctionary additions and add them that way. Certainly isn't ideal to include definitions in the ext. file, as when it comes to localisation, you are then editing x numbers of files instead of one.
  • Options
    ullo stuart!

    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.
  • Options
    peapea New
    edited August 2005
    Maybe, every extension should be allowed its own directory in the Extensions folder. That way each Extension could contain its own files. Like a settings.php file and a Dictionary folder with various localizations. And these files would stay together as part of this one little module that is an Extension. That would seem to make sense, somehow.

    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.
  • Options
    stuart - while i could quite easily make it add new definitions (and probably will do for the sake of it) as pea says in this instance it wouldnt be very productive. Thanks for the idea though, i imagine it could be useful...somewhere. I suppose dictionaries with extensions will always be hard because where extensions do need their own text it would be insane to add them to the main dictionary but also quite wrong to create their own. I dont suppose there is any way round that though. *scratches head
  • Options
    MarkMark Vanilla Staff
    This has been discussed in another thread in great detail. The resolutions that I came up with (And still need to document on the wiki) are:

    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.
  • Options
    You are a king amongst men, Sir. Thanks!
This discussion has been closed.