function locale_translate_import_form
7.x locale.admin.inc | locale_translate_import_form( |
6.x locale.inc | locale_translate_import_form() |
User interface for the translation import screen.
Related topics
1 string reference to 'locale_translate_import_form'
- locale_menu in drupal-7.x/
modules/ locale/ locale.module - Implements hook_menu().
File
- drupal-7.x/
modules/ locale/ locale.admin.inc, line 928 - Administration functions for locale.module.
Code
function locale_translate_import_form($form) {
// Get all languages, except English
drupal_static_reset('language_list');
$names = locale_language_list('name');
unset($names['en']);
if (!count($names)) {
$languages = _locale_prepare_predefined_list();
$default = key($languages);
}
else {
$languages = array(
t('Already added languages') => $names,
t('Languages not yet added') => _locale_prepare_predefined_list()
);
$default = key($names);
}
$form['import'] = array('#type' => 'fieldset',
'#title' => t('Import translation'),
);
$form['import']['file'] = array('#type' => 'file',
'#title' => t('Language file'),
'#size' => 50,
'#description' => t('A Gettext Portable Object (<em>.po</em>) file.'),
);
$form['import']['langcode'] = array('#type' => 'select',
'#title' => t('Import into'),
'#options' => $languages,
'#default_value' => $default,
'#description' => t('Choose the language you want to add strings into. If you choose a language which is not yet set up, it will be added.'),
);
$form['import']['group'] = array('#type' => 'radios',
'#title' => t('Text group'),
'#default_value' => 'default',
'#options' => module_invoke_all('locale', 'groups'),
'#description' => t('Imported translations will be added to this text group.'),
);
$form['import']['mode'] = array('#type' => 'radios',
'#title' => t('Mode'),
'#default_value' => LOCALE_IMPORT_KEEP,
'#options' => array(
LOCALE_IMPORT_OVERWRITE => t('Strings in the uploaded file replace existing ones, new ones are added. The plural format is updated.'),
LOCALE_IMPORT_KEEP => t('Existing strings and the plural format are kept, only new strings are added.')
),
);
$form['import']['submit'] = array('#type' => 'submit', '#value' => t('Import'));
return $form;
}