i18n_field.pages.inc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * @file
  4. * Translation page for fields.
  5. */
  6. /**
  7. * Field translation page
  8. *
  9. * We need to translate field and field instance.
  10. */
  11. function i18n_field_page_translate($instance, $language = NULL) {
  12. module_load_include('inc', 'i18n_string', 'i18n_string.pages');
  13. if (!$language) {
  14. // Overview page will be the regular one
  15. return i18n_string_translate_page_object('field_instance', $instance);
  16. }
  17. else {
  18. // Because of some weird menu mapping for comment fields language object loader is not working.
  19. $language = i18n_language_object($language);
  20. drupal_set_title(t('Translate to !language', array('!language' => i18n_language_name($language->language))));
  21. //return drupal_get_form('i18n_field_page_translate_form', $instance, $language->language);
  22. // Create form with two tabs, one for instance, once for field.
  23. $groups = array(
  24. 'instance' => t('Field instance'),
  25. 'field' => t('Field settings'),
  26. );
  27. // Field instance
  28. $instance_object = i18n_object('field_instance', $instance);
  29. $strings['instance'] = $instance_object->get_strings(array('empty' => TRUE));
  30. // Field settings
  31. $field_object = i18n_object('field', $instance);
  32. $strings['field'] = $field_object->get_strings(array('empty' => TRUE));
  33. return drupal_get_form('i18n_string_translate_page_form', $strings, $language->language, $groups);
  34. }
  35. }