Révision 503b3f7b
Ajouté par Assos Assos il y a environ 10 ans
drupal7/sites/all/modules/l10n_update/l10n_update.admin.inc | ||
---|---|---|
59 | 59 |
$build['admin_import_form'] = drupal_get_form('l10n_update_admin_import_form', $projects, $updates); |
60 | 60 |
} |
61 | 61 |
else { |
62 |
$build['no_projects'] = array('#markup' => t('No projects or languages to update.'));
|
|
62 |
$build['no_languages'] = array('#markup' => t('No translatable language defined. <a href="/admin/config/regional/language">Add a language</a>.'));
|
|
63 | 63 |
} |
64 | 64 |
return $build; |
65 | 65 |
} |
... | ... | |
96 | 96 |
'#type' => 'value', |
97 | 97 |
'#value' => $updates, |
98 | 98 |
); |
99 |
// @todo Only show this language fieldset if we have more than 1 language. |
|
100 |
$form['lang'] = array( |
|
101 |
'#type' => 'fieldset', |
|
102 |
'#title' => t('Languages'), |
|
103 |
'#collapsible' => TRUE, |
|
104 |
'#collapsed' => TRUE, |
|
105 |
'#description' => t('Select one or more languages to download and update. If you select none, all of them will be updated.'), |
|
106 |
); |
|
107 |
$form['lang']['languages'] = array( |
|
108 |
'#type' => 'checkboxes', |
|
109 |
'#options' => $languages, |
|
110 |
); |
|
111 |
$form['mode'] = array( |
|
112 |
'#type' => 'radios', |
|
113 |
'#title' => t('Update mode'), |
|
114 |
'#default_value' => variable_get('l10n_update_import_mode', LOCALE_IMPORT_KEEP), |
|
115 |
'#options' => _l10n_update_admin_import_options(), |
|
116 |
); |
|
117 |
$form['buttons']['download'] = array( |
|
118 |
'#type' => 'submit', |
|
119 |
'#value' => t('Update translations'), |
|
120 |
); |
|
99 |
|
|
100 |
if (count($languages) > 1) { |
|
101 |
$form['lang'] = array( |
|
102 |
'#type' => 'fieldset', |
|
103 |
'#title' => t('Languages'), |
|
104 |
'#collapsible' => TRUE, |
|
105 |
'#collapsed' => FALSE , |
|
106 |
'#description' => t('Select one or more languages to download and update. If you select none, all of them will be updated.'), |
|
107 |
); |
|
108 |
$form['lang']['languages'] = array( |
|
109 |
'#type' => 'checkboxes', |
|
110 |
'#options' => $languages, |
|
111 |
); |
|
112 |
} |
|
113 |
|
|
114 |
if ($updates) { |
|
115 |
$form['actions']['download'] = array( |
|
116 |
'#type' => 'submit', |
|
117 |
'#value' => t('Update translations'), |
|
118 |
); |
|
119 |
} |
|
121 | 120 |
} |
122 |
$form['buttons']['refresh'] = array(
|
|
121 |
$form['actions']['refresh'] = array(
|
|
123 | 122 |
'#type' => 'submit', |
124 | 123 |
'#value' => t('Refresh information'), |
125 | 124 |
); |
... | ... | |
137 | 136 |
$projects = l10n_update_get_projects(); |
138 | 137 |
|
139 | 138 |
if ($op == t('Update translations')) { |
140 |
$languages = array_filter($form_state['values']['languages']);
|
|
139 |
$languages = isset($form_state['values']['languages']) ? array_filter($form_state['values']['languages']) : NULL;
|
|
141 | 140 |
$updates = $form_state['values']['updates']; |
142 |
$mode = $form_state['values']['mode']; |
|
141 |
$mode = variable_get('l10n_update_import_mode', LOCALE_IMPORT_KEEP); |
|
142 |
|
|
143 | 143 |
if ($projects && $updates) { |
144 | 144 |
module_load_include('batch.inc', 'l10n_update'); |
145 | 145 |
// Filter out updates in other languages. If no languages, all of them will be updated |
... | ... | |
147 | 147 |
$batch = l10n_update_batch_multiple($updates, $mode); |
148 | 148 |
batch_set($batch); |
149 | 149 |
} |
150 |
else { |
|
151 |
drupal_set_message(t('Cannot find any translation updates.'), 'error'); |
|
152 |
} |
|
153 | 150 |
} |
154 | 151 |
elseif ($op == t('Refresh information')) { |
155 | 152 |
// Get current version of projects. |
Formats disponibles : Unified diff
Weekly update of contrib modules