[translations] autolocale automatic installation
Jakub Suchy
jakub at rtfm.cz
Thu Jan 18 20:33:13 UTC 2007
Gabor Hojtsy wrote:
> 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
Is this clean and does it have some catch? It works for me
function autolocale_form_alter($form_id, &$form) {
// Process only if module form is displayed
if ($form_id === "system_modules") {
// Determine which modules are enabled at the moment
if (is_array($form['status']['#default_value'])) {
$autolocale_modules = array();
foreach ($form['status']['#default_value'] as $module) {
array_push($autolocale_modules, $module);
}
// We MUST skip module confirm form
if ($_GET['q'] != "admin/build/modules/list/confirm") {
$enabled = array_diff($autolocale_modules, $_SESSION['autolocale_modules']);
if (!empty($enabled)) {
// These modules have been enabled
print_r($enabled); // TODO
}
}
// Store modules for next reload
$_SESSION['autolocale_modules'] = $autolocale_modules;
}
}
}
More information about the translations
mailing list