i18n_sync.modules.inc 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * @file
  4. * Internationalization (i18n) package. Synchronization of translations
  5. *
  6. * Implements hook_i18n_sync_node_fields() for several core modules.
  7. */
  8. /**
  9. * Book module. Implements hook_i18n_sync_options().
  10. */
  11. function book_i18n_sync_options($entity_type, $bundle_name) {
  12. if ($entity_type == 'node') {
  13. return array(
  14. 'parent' => array(
  15. 'title' => t('Book outline'),
  16. 'description' => t('Set the translated parent for each translation if possible.')
  17. ),
  18. );
  19. }
  20. }
  21. /**
  22. * Comment module. Implements hook_i18n_sync_options().
  23. */
  24. function comment_i18n_sync_options($entity_type, $bundle_name) {
  25. if ($entity_type == 'node') {
  26. $fields['comment'] = array('title' => t('Comment settings'));
  27. return $fields;
  28. }
  29. }
  30. /**
  31. * Field module. Implements hook_i18n_sync_options().
  32. */
  33. function field_i18n_sync_options($entity_type, $bundle_name) {
  34. $sync_fields = array();
  35. if ($bundle_name) {
  36. $instances = field_info_instances($entity_type, $bundle_name);
  37. foreach ($instances as $name => $instance) {
  38. $sync_fields[$name] = array(
  39. 'title' => $instance['label'],
  40. 'description' => $instance['description'],
  41. 'field_name' => $instance['field_name'],
  42. 'group' => 'fields',
  43. );
  44. }
  45. }
  46. return $sync_fields;
  47. }
  48. /**
  49. * Node module. Implements hook_i18n_sync_options().
  50. */
  51. function node_i18n_sync_options($entity_type, $bundle_name) {
  52. if ($entity_type == 'node') {
  53. return array(
  54. 'uid' => array('title' => t('Author')),
  55. 'status' => array('title' => t('Status')),
  56. 'created' => array('title' => t('Post date')),
  57. 'promote' => array('title' => t('Promote')),
  58. 'moderate' => array('title' => t('Moderate')),
  59. 'sticky' => array('title' => t('Sticky')),
  60. 'revision' => array('title' => t('Revision'), 'description' => t('Create also new revision for translations')),
  61. );
  62. }
  63. }