You are here

README.txt in Internationalization 7

README.txt
==========
Drupal module: Translation set API
==================================

This is a generic API to handle translation sets. It is being used for now
for path translation and taxonomy term translation inside i18n package.

Translation sets can hold a collection of entities or other objects. A translation set is itself
an Entity thus leveraging all the power of the Entity API.

It also provides some basic storage for translation sets and a generator of new translation set id.
However, each module is responsible for storing which objects belong to which translation set for which
it needs to override some methods of the base i18n_translation_set class.

- load_translations()
- save_translations()
- clean_translations()
- delete_translations()

Once these are implemented, to get the objects belonging to a translation set, indexed by language code,
you can invoke this method on a translation set object:

- get_translations()

To define a new type of translation set, a module must implement hook_i18n_translation_set_info() 
as in this example:

/**
 * Implements hook_i18n_translation_set_info().
 */
function i18n_path_i18n_translation_set_info() {
  return array(
    'path' => array(
      'title' => t('Paths'),
      'class' => 'i18n_path_translation_set',
    )
  );
}

See examples of overriding and extending this API:
- i18n_path/i18n_path.inc
- i18n_taxonomy/i18n_taxonomy.inc

====================================================================
Jose A. Reyero, http://reyero.net

File

i18n_translation/README.txt
View source
  1. README.txt
  2. ==========
  3. Drupal module: Translation set API
  4. ==================================
  5. This is a generic API to handle translation sets. It is being used for now
  6. for path translation and taxonomy term translation inside i18n package.
  7. Translation sets can hold a collection of entities or other objects. A translation set is itself
  8. an Entity thus leveraging all the power of the Entity API.
  9. It also provides some basic storage for translation sets and a generator of new translation set id.
  10. However, each module is responsible for storing which objects belong to which translation set for which
  11. it needs to override some methods of the base i18n_translation_set class.
  12. - load_translations()
  13. - save_translations()
  14. - clean_translations()
  15. - delete_translations()
  16. Once these are implemented, to get the objects belonging to a translation set, indexed by language code,
  17. you can invoke this method on a translation set object:
  18. - get_translations()
  19. To define a new type of translation set, a module must implement hook_i18n_translation_set_info()
  20. as in this example:
  21. /**
  22. * Implements hook_i18n_translation_set_info().
  23. */
  24. function i18n_path_i18n_translation_set_info() {
  25. return array(
  26. 'path' => array(
  27. 'title' => t('Paths'),
  28. 'class' => 'i18n_path_translation_set',
  29. )
  30. );
  31. }
  32. See examples of overriding and extending this API:
  33. - i18n_path/i18n_path.inc
  34. - i18n_taxonomy/i18n_taxonomy.inc
  35. ====================================================================
  36. Jose A. Reyero, http://reyero.net