i18n_field.i18n.inc 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * @file
  4. * Internationalization (i18n) hooks
  5. */
  6. /**
  7. * Implements hook_i18n_object_info().
  8. */
  9. function i18n_field_i18n_object_info() {
  10. $info['field'] = array(
  11. 'title' => t('Field'),
  12. 'class' => 'i18n_field',
  13. 'key' => 'field_name',
  14. 'load callback' => 'field_info_field',
  15. 'placeholders' => array(
  16. '%field_ui_menu' => 'field_name',
  17. '%field_type' => 'type',
  18. ),
  19. 'edit path' => 'admin/structure/types/manage/%bundle/fields/%field_ui_menu/field-settings',
  20. // We can easily list all these objects
  21. 'list callback' => 'field_read_fields',
  22. 'string translation' => array(
  23. 'textgroup' => 'field',
  24. 'properties' => array(
  25. 'label' => array(
  26. 'title' => t('Label'),
  27. ),
  28. ),
  29. //'translate path' => 'admin/structure/block/manage/%module/%delta/translate/%i18n_language',
  30. )
  31. );
  32. $info['field_instance'] = array(
  33. 'title' => t('Field instance'),
  34. 'class' => 'i18n_field_instance',
  35. 'key' => array('field_name', 'bundle'),
  36. 'placeholders' => array(
  37. '%bundle' => 'bundle',
  38. '%field_ui_menu' => 'field_name',
  39. ),
  40. 'edit path' => 'admin/structure/types/manage/%bundle/fields/%field_ui_menu',
  41. // We can easily list all these objects.
  42. 'list callback' => 'field_read_instances',
  43. // Metadata for string translation.
  44. 'string translation' => array(
  45. 'textgroup' => 'field',
  46. 'properties' => array(
  47. 'label' => array(
  48. 'title' => t('Label'),
  49. ),
  50. 'description' => array(
  51. 'title' => t('Description'),
  52. 'format' => 'format',
  53. ),
  54. 'default_value' => array(
  55. 'title' => t('Default value'),
  56. 'format' => 'format',
  57. ),
  58. ),
  59. //'translate path' => 'admin/structure/types/manage/%bundle/fields/%field_ui_menu/translate/%i18n_language',
  60. )
  61. );
  62. return $info;
  63. }
  64. /**
  65. * Implements hook_i18n_string_info().
  66. */
  67. function i18n_field_i18n_string_info() {
  68. $groups['field'] = array(
  69. 'title' => t('Fields'),
  70. 'description' => t('Configurable fields descriptions, defaults, options, etc.'),
  71. 'format' => FALSE, // This group doesn't have formatted strings
  72. 'list' => TRUE, // This group can list all strings
  73. 'class' => 'i18n_string_textgroup_cached',
  74. );
  75. return $groups;
  76. }
  77. /**
  78. * Implements hook_i18n_field_info().
  79. */
  80. function i18n_field_i18n_field_info() {
  81. $info['text'] = $info['text_long'] = $info['text_with_summary'] = array(
  82. 'translate_default' => 'i18n_field_translate_default',
  83. );
  84. $info['list_text'] = $info['list_boolean'] = $info['list_integer'] = array(
  85. 'translate_options' => 'i18n_field_translate_allowed_values',
  86. );
  87. return $info;
  88. }