[translations] autolocale automatic installation
Gabor Hojtsy
gabor at hojtsy.hu
Wed Jan 17 19:48:19 UTC 2007
Jakub Suchy wrote:
>> Indeed. I tried to get in a patch to Drupal 5 to support our
>> implementation of these kind of features, but it was too late in the
>> cycle, so it was rejected. We either need to duplicate the functionality
>> from the module and theme admin pages, or we need to stick in two submit
>> callbacks to the forms, one that runs early, and one that runs last, so
>> we can see, what was changed in the database about modules
>> (enabled/disabled/installed) and themes (enabled/disabled). That way, we
>> can stick our process into the enable/disable flow.
>>
>> As far as I see know, adding a pre-submit and a post-submit callback is
>> the better way to go, as it involves less core code duplication (but
>> more database magic).
>
> Or submit a patch to module.inc something like hook_postinstall() using
> module_invoke_all?
It is not going to solve the problem for Drupal 5, since Drupal 5 is not
going to have new features (eg. hooks) anymore. It is released, stable.
It will get maintained but that does not mean any new hooks added, just
errors corrected. This can be added into Drupal 6 though for which the
whole autolocale (feature, not the actual code) is requested to be
included anyway.
We need to find a way in Drupal 5 without core patching, and
autolocale_form_alter()-ing the module and theme forms, adding an early
and a last callback seems to do the trick:
1. Check the database (or the module_list()) in the early callback.
2. Check it again at the callback called last.
3. Compute the difference.
4. Import what needs to be imported
Unfortunately we cannot remove strings for disabled stuff, but we can
look into this for Drupal 6.
See the stub is already in autolocale.module since a few weeks:
/**
* Implementation of hook_form_alter()
*
* @todo
* Alter system form to catch module enable/disable actions
*/
function autolocale_form_alter($form_id, &$form) {
}
Gabor
More information about the translations
mailing list