You are here

function i18nprofile_translation_category in Internationalization 5.2

Same name and namespace in other branches
  1. 5.3 i18nprofile/i18nprofile.module \i18nprofile_translation_category()
  2. 5 i18nprofile/i18nprofile.module \i18nprofile_translation_category()

Form to translate category names

1 string reference to 'i18nprofile_translation_category'
i18nprofile_translation in i18nprofile/i18nprofile.module
Menu callback: profile translations

File

i18nprofile/i18nprofile.module, line 196

Code

function i18nprofile_translation_category($lang) {
  $categories = profile_categories();
  foreach ($categories as $category) {
    $source[drupal_urlencode($category['name'])] = $category['title'];
  }
  $languages = i18n_supported_languages();
  $language = $languages[$lang];
  $translation = variable_get('i18nprofile_' . $lang, array());
  $form['language'] = array(
    '#type' => 'value',
    '#value' => $lang,
  );
  $form['translation'] = array(
    '#type' => 'fieldset',
    '#title' => $language,
    '#tree' => TRUE,
  );
  foreach ($categories as $category) {
    $form['translation'][$category['name']] = array(
      '#type' => 'textfield',
      '#title' => $category['title'],
      '#default_value' => $translation[$category['name']],
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}