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