Commit 580faf84 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#162324 by mooffie: keep previously default language enabled and only...

#162324 by mooffie: keep previously default language enabled and only increment enabled language count, if we are in fact adding an enabled language
parent f8526cb5
......@@ -97,10 +97,13 @@ function theme_locale_languages_overview_form($form) {
*/
function locale_languages_overview_form_submit($form, &$form_state) {
$languages = language_list();
$default = language_default();
$enabled_count = 0;
foreach ($languages as $langcode => $language) {
if ($form_state['values']['site_default'] == $langcode) {
// Automatically enable the default language.
if ($form_state['values']['site_default'] == $langcode || $default->language == $langcode) {
// Automatically enable the default language and the language
// which was default previously (because we will not get the
// value from that disabled checkox).
$form_state['values']['enabled'][$langcode] = 1;
}
if ($form_state['values']['enabled'][$langcode]) {
......@@ -917,8 +920,10 @@ function locale_add_language($langcode, $name = NULL, $native = NULL, $direction
variable_set('language_default', (object) array('language' => $langcode, 'name' => $name, 'native' => $native, 'direction' => $direction, 'enabled' => (int) $enabled, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => $prefix, 'weight' => 0));
}
// Increment count of enabled languages.
variable_set('language_count', variable_get('language_count', 1) + 1);
if ($enabled) {
// Increment enabled language count if we are adding an enabled language.
variable_set('language_count', variable_get('language_count', 1) + 1);
}
watchdog('locale', 'The %language language (%code) has been created.', array('%language' => $name, '%code' => $langcode));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment