Details
-
New Feature
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.8.3, 2.9
-
MOODLE_28_STABLE, MOODLE_29_STABLE
-
MOODLE_29_STABLE
-
MDL-49361-master-stringman -
Description
Currently, the factory function get_string_manager() returns singleton instance of core_string_manager_install() in early stages of the site installation, or instance of core_string_manager_standard().
Proposal
This is a proposal to introduce a new config.php setting like $CFG->alternativestringmanager. If that setting is found and it contains a valid class name, and that class implements interface core_string_manager, then it is used as the string manager instead of the default one. The class would be typically provided by an additional plugin. The setting must be defined via config.php only. The value in mdl_config table will be ignored (so that malicious plugin can't inject it secretly).
Use-cases
- String usage accounting plugin - this will allow us to implement a plugin that collects and logs string usage (together with the context, user role etc). This can lead to a report on what strings are most important ones to be translated (for students, for teachers etc).
- Ability to override strings in one component via additional plugin - see
MDL-46582 - Ability to have a plugin that allows local language customization and/or language pack contribution directly at the page where the string appears (it would log all the get_string() calls in the current request and then somehow inject them into the page footer so that they could be used by a JS on the client, for example).
- Experimental implementations of advanced plural handling, Google translator integration and all other crazy stuff.