If Google can do something like http://translate.google.com/, surely we
can do something just as good in Moodle. Here is a first attempt. It is
a bit rough around the edges, and only a couple of target lananguages
have been implemented so far. (More and better attempts welcome!)
In order to ensure that this gets adequate testing, I have made sure that
it gets turn on by default. However, if you really don't like it, you can
turn it off under Administration > Development -> Experimental settings.
This makes filters more plugginable, becuase with this lang file name, get_string will look for the filter name in filter/myfilter/lang/en_utf8/filter_myfilter.php.
To do this, there is a new function filter_get_name in filterlib that contains the logic.
Also, a new function filter_get_all_installed to replace the logic for getting all filters that was duplicated in three places.
filter_get_name no longer does such a nice fall-back if the name is missing, to encourage people to supply the right string. The fallback now looks like '[[filtername]] (filter/tidy)'.
MDL-18669 get_string refactored to elimiate duplicate code and make it easier to understand.
MDL-17763 parent language not processed correctly when getting a plugin string.
MDL-16181 more intelligent caching to avoid repeated file_exists checks.
MDL-12434 move values to array keys to improve lookup times.
The main part of the refactoring is to create a singleton string_manager class to encapsulate the cached data and the processing, while breaking the code up into more smaller methods.
Other performance improvements include:
* Cache results of plugin name -> locations to search array.
* Cache parent lang lookup.
* Skip eval if the string does not contain $ \ or %.
* Remove the unnecessary sprintf from the eval.
There is a performance testing script in lib/simpletest/getstringperformancetester.php. For now this script has the old get_string implementation copied and pasted to the end, and renamed to old_get_string to allow for comparitive timings.
There are now some unit tests for get_string in lib/simpletest/teststringmanager.php. I think I have managed to cover most of the tricky cases.
This is a minimal fix for MDL-18554, I have just added a cancel button and made it work.
The more substantial part of this is MDL-17454, trying to make the quiz editing screen behave appropriately when shuffle questions is on. I am sure Olli will have opinions about this and want to change it further. Rought summary:
* When shufflequestions is off, never restrict manual paging, even if questionsperpage is set.
* When shuffle questions is on:
** Always display the quiz with the defined number of questions per page.
** Remove controls to add things except at the end of the quiz.
** Disable most of the order and paging tab, but still allow the question list to be reordered, in case that helps teachers track which questions they have added.
** Still allow questions to be reordered on the edit tab, but when moving the top question on a page up, reorder with the previous question, rather than moving to the previous page.
* Change the status bar, so that the yellow highlight is reserved for alert information. The more informative stuff is now plain, and moved to under the title. To my mind that associates it more closely with the quiz name. Also it moves Total of grades and Maximum grade closer together.
* JavaScript cleaned up. I learn more about YUI every day.
* Some PHP code clean ups that I forgot to commit separately before making substantive changes.
* change the wording of the settings.
* add a repaginate now checkbox (disabled if shuffle is on).
* JavaScript to automatically check the checkbox when qpp changes.
* (remove some irrelevant return value checks now we use exceptions.)