You are here

function hook_i18n_object_info in Internationalization 7

Provide information about object types handled by i18n system.

Other features like translation sets (i18n_translation) or string translation (i18n_string) rely on the information provided by this hook for automating string translation

See also

i18n_object_info()

7 functions implement hook_i18n_object_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

i18n_block_i18n_object_info in i18n_block/i18n_block.i18n.inc
Implements hook_i18n_object_info().
i18n_contact_i18n_object_info in i18n_contact/i18n_contact.i18n.inc
Implements hook_i18n_object_info().
i18n_field_i18n_object_info in i18n_field/i18n_field.i18n.inc
Implements hook_i18n_object_info().
i18n_menu_i18n_object_info in i18n_menu/i18n_menu.i18n.inc
Implements hook_i18n_object_info().
i18n_node_i18n_object_info in i18n_node/i18n_node.i18n.inc
Implements hook_i18n_object_info().

... See full list

2 invocations of hook_i18n_object_info()
i18n_object_info in ./i18n.module
Get translation information for objects
i18n_string_module_string_list in i18n_string/i18n_string.admin.inc
Get all strings from a module.

File

./i18n.api.php, line 19
API documentation for Internationalization module

Code

function hook_i18n_object_info() {

  // Information for node type object, see i18n_node_i18n_object_info()
  $info['node_type'] = array(
    // Generic object properties, title, etc..
    'title' => t('Node type'),
    // Field to be used as key to index different node types
    'key' => 'type',
    // Mapping object fields and menu place holders
    'placeholders' => array(
      '%node_type' => 'type',
    ),
    // Path for automatically generated translation tabs. Note placeholders above are used here.
    'edit path' => 'admin/structure/types/manage/%node_type',
    'translate tab' => 'admin/structure/types/manage/%node_type/translate',
    // We can easily list all these objects because they should be limited and manageable
    // Only in this case we provide a 'list callback'.
    'list callback' => 'node_type_get_types',
    // Metadata for string translation
    // In this case we are defining fields and keys for string translation's string names
    // String ids are of the form: [textgroup]:[type]:[key]:[property]
    // Thus in this case we'll have string names like
    // - node:type:story:name
    // - node:type:story:description
    'string translation' => array(
      'textgroup' => 'node',
      'type' => 'type',
      'properties' => array(
        'name' => t('Name'),
        'title_label' => t('Title label'),
        'description' => t('Description'),
        'help' => t('Help text'),
      ),
      'translate path' => 'admin/structure/types/manage/%node_type/translate/%i18n_language',
    ),
  );

  // Example information for taxonomy term object, see i18n_taxonomy_i18n_object_info().
  $info['taxonomy_term'] = array(
    'title' => t('Taxonomy term'),
    'class' => 'i18n_taxonomy_term',
    'entity' => 'taxonomy_term',
    'key' => 'tid',
    'placeholders' => array(
      '%taxonomy_term' => 'tid',
    ),
    // Auto generate edit path
    'edit path' => 'taxonomy/term/%taxonomy_term/edit',
    // Auto-generate translate tab
    'translate tab' => 'taxonomy/term/%taxonomy_term/translate',
    'string translation' => array(
      'textgroup' => 'taxonomy',
      'type' => 'term',
      'properties' => array(
        'name' => t('Name'),
        'description' => array(
          'title' => t('Description'),
          'format' => 'format',
        ),
      ),
    ),
  );
  return $info;
}