stayradiated/Nitro — pull request #124 by mlms13 (2012-07-23 08:31:54+00:00)
Title: Allow translating plugins and make datepicker a plugin

Here it is, the complete package. :)

I started out by doing a little code reorganization in `main.js` so that the `plugin` global is defined at the top of the document, and the `$(document).ready` stuff is after the variables have been defined.

Then, I moved the language loading stuff out of document ready. Now it does an ajax request for the language pack as soon as possible and delays loading the plugins until after the language has loaded. The interface loads after the plugins have loaded. This makes `main.js` responsible for loading a couple scripts instead of `index.html`. This was the best way I could come up with to ensure certain scripts are loaded in order. Loading from cache, this doesn't add more than ~5ms to Nitro's startup time for me.

Finally, I moved `bootstrap-datepicker.js` out of `libs` and into `plugins` so that it can be translated, and I reapplied my earlier changes so that it uses our existing dictionaries for translations.

If you can think of a better way to do this, feel free to reject this pull request, but this is the most straightforward approach I could come up with.