diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc index ed3d3a6..0e033bb 100644 --- a/core/modules/locale/locale.bulk.inc +++ b/core/modules/locale/locale.bulk.inc @@ -28,8 +28,12 @@ function locale_translate_import_form($form, &$form_state) { // the list of existing and then predefined languages. form_load_include($form_state, 'inc', 'language', 'language.admin'); if (empty($existing_languages)) { - $language_options = language_admin_predefined_list(); - $default = key($language_options); + $language_options = array_merge( + array('' => t('- Select a language -')), + language_admin_predefined_list()); + $default = ''; + $required = TRUE; + $desc = t('The language will be added automatically.'); } else { $default = key($existing_languages); @@ -37,8 +41,18 @@ function locale_translate_import_form($form, &$form_state) { t('Existing languages') => $existing_languages, t('Languages not yet added') => language_admin_predefined_list() ); + // Don't set 'required' mark if it doensn't matter anyway. + $required = FALSE; + $desc = ''; } + // Check for existing translations; the overwrite_optinos are unnecessary + // if they don't exist. This is unlikely (and the check is imperfect since + // we do not check for specific languages) but may still help ease confusion + // on new sites. + $existing_c = (bool) db_query_range('SELECT 1 FROM {locales_target} WHERE customized = 1', 0, 1)->fetchField(); + $existing_nc = (bool) db_query_range('SELECT 1 FROM {locales_target} WHERE customized = 0', 0, 1)->fetchField(); + $form['file'] = array( '#type' => 'file', '#title' => t('Translation file'), @@ -50,28 +64,34 @@ function locale_translate_import_form($form, &$form_state) { '#title' => t('Language'), '#options' => $language_options, '#default_value' => $default, + '#required' => $required, + '#description' => $desc, ); $form['customized'] = array( - '#title' => t('Treat imported strings as custom translations'), + '#title' => t('Treat imported strings as customized translations'), '#type' => 'checkbox', + '#description' => t("Until you've actively used the distinction (by e.g. using this import screen), 'customized' is everything entered through the 'Translate' screen. 'non-customized' is everything else."), ); $form['overwrite_options'] = array( '#type' => 'container', '#tree' => TRUE, ); $form['overwrite_options']['not_customized'] = array( - '#title' => t('Overwrite non-customized translations'), + '#title' => t('Overwrite existing non-customized translations'), '#type' => 'checkbox', '#states' => array( 'checked' => array( ':input[name="customized"]' => array('checked' => TRUE), ), ), + '#access' => $existing_nc, ); $form['overwrite_options']['customized'] = array( '#title' => t('Overwrite existing customized translations'), '#type' => 'checkbox', + '#description' => t("One of the situations where you probably want to check the corresponding 'Overwrite' checkbox, is if you are re-importing an updated .po file which was imported earlier."), + '#access' => $existing_c, ); $form['actions'] = array(