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