Removing translation directories
[project/views.git] / modules / locale.views.inc
1 <?php
2
3 /**
4 * @file
5 *
6 * Provides views data and handlers for locale.module.
7 */
8
9 /**
10 * @defgroup views_locale_module locale.module handlers
11 *
12 * @{
13 */
14
15 /**
16 * Implementation of hook_views_data().
17 */
18 function locale_views_data() {
19 // Basic table information.
20
21 // Define the base group of this table.
22 $data['locales_source']['table']['group'] = t('Locale source');
23
24 // Advertise this table as a possible base table.
25 $data['locales_source']['table']['base'] = array(
26 'field' => 'lid',
27 'title' => t('Locale source'),
28 'help' => t('A source string for translation, in English or the default site language.'),
29 );
30
31 // lid
32 $data['locales_source']['lid'] = array(
33 'title' => t('LID'),
34 'help' => t('The ID of the source string.'),
35 'field' => array(
36 'handler' => 'views_handler_field',
37 'click sortable' => TRUE,
38 ),
39 'argument' => array(
40 'handler' => 'views_handler_argument_numeric',
41 'numeric' => TRUE,
42 'validate type' => 'lid',
43 ),
44 'filter' => array(
45 'handler' => 'views_handler_filter_numeric',
46 ),
47 'sort' => array(
48 'handler' => 'views_handler_sort',
49 ),
50 );
51
52 // location
53 $data['locales_source']['location'] = array(
54 'group' => t('Locale source'),
55 'title' => t('Location'),
56 'help' => t('A description of the location or context of the string.'),
57 'field' => array(
58 'handler' => 'views_handler_field',
59 'click sortable' => TRUE,
60 ),
61 'sort' => array(
62 'handler' => 'views_handler_sort',
63 ),
64 'filter' => array(
65 'handler' => 'views_handler_filter_string',
66 ),
67 'argument' => array(
68 'handler' => 'views_handler_argument_string',
69 ),
70 );
71
72 // Group field
73 $data['locales_source']['textgroup'] = array(
74 'group' => t('Locale source'),
75 'title' => t('Group'),
76 'help' => t('The group the translation is in.'),
77 'field' => array(
78 'handler' => 'views_handler_field_locale_group',
79 'click sortable' => TRUE,
80 ),
81 'filter' => array(
82 'handler' => 'views_handler_filter_locale_group',
83 ),
84 'argument' => array(
85 'handler' => 'views_handler_argument_locale_group',
86 ),
87 );
88
89 // Source field
90 $data['locales_source']['source'] = array(
91 'group' => t('Locale source'),
92 'title' => t('Source'),
93 'help' => t('The full original string.'),
94 'field' => array(
95 'handler' => 'views_handler_field',
96 ),
97 'filter' => array(
98 'handler' => 'views_handler_filter_string',
99 ),
100 );
101
102 // Version field
103 $data['locales_source']['version'] = array(
104 'group' => t('Locale source'),
105 'title' => t('Version'),
106 'help' => t('The version of Drupal core that this string is for.'),
107 'field' => array(
108 'handler' => 'views_handler_field',
109 'click sortable' => TRUE,
110 ),
111 'filter' => array(
112 'handler' => 'views_handler_filter_locale_version',
113 ),
114 'argument' => array(
115 'handler' => 'views_handler_argument_string',
116 ),
117 );
118
119 $data['locales_source']['edit_lid'] = array(
120 'group' => t('Locale source'),
121 'field' => array(
122 'title' => t('Edit link'),
123 'help' => t('Provide a simple link to edit the translations.'),
124 'handler' => 'views_handler_field_locale_link_edit',
125 ),
126 );
127
128 // ----------------------------------------------------------------------
129 // Locales target table
130
131 // Define the base group of this table. Fields that don't
132 // have a group defined will go into this field by default.
133 $data['locales_target']['table']['group'] = t('Locale target');
134
135 // Join information
136 $data['locales_target']['table']['join'] = array(
137 'locales_source' => array(
138 'left_field' => 'lid',
139 'field' => 'lid',
140 ),
141 );
142
143 // Translation field
144 $data['locales_target']['translation'] = array(
145 'group' => t('Locale target'),
146 'title' => t('Translation'),
147 'help' => t('The full translation string.'),
148 'field' => array(
149 'handler' => 'views_handler_field',
150 ),
151 'filter' => array(
152 'handler' => 'views_handler_filter_string',
153 ),
154 );
155
156 // Language field
157 $data['locales_target']['language'] = array(
158 'group' => t('Locale target'),
159 'title' => t('Language'),
160 'help' => t('The language this translation is in.'),
161 'field' => array(
162 'handler' => 'views_handler_field_locale_language',
163 'click sortable' => TRUE,
164 ),
165 'filter' => array(
166 'handler' => 'views_handler_filter_locale_language',
167 ),
168 'argument' => array(
169 'handler' => 'views_handler_argument_locale_language',
170 ),
171 );
172
173 $data['locales_target']['plid'] = array(
174 'group' => t('Locale target'),
175 'title' => t('Singular LID'),
176 'help' => t('The ID of the parent translation.'),
177 'field' => array(
178 'handler' => 'views_handler_field',
179 ),
180 );
181
182 // Plural
183 $data['locales_target']['plural'] = array(
184 'group' => t('Locale target'),
185 'title' => t('Plural'),
186 'help' => t('Whether or not the translation is plural.'),
187 'field' => array(
188 'handler' => 'views_handler_field_boolean',
189 'click sortable' => TRUE,
190 ),
191 'filter' => array(
192 'handler' => 'views_handler_filter_boolean_operator',
193 'label' => t('Plural'),
194 'type' => 'yes-no',
195 ),
196 'sort' => array(
197 'handler' => 'views_handler_sort',
198 ),
199 );
200
201 return $data;
202 }
203
204 /**
205 * Implementation of hook_views_handlers().
206 */
207 function locale_views_handlers() {
208 return array(
209 'info' => array(
210 'path' => drupal_get_path('module', 'views') . '/modules/locale',
211 ),
212 'handlers' => array(
213 // Field handlers.
214 'views_handler_field_locale_group' => array(
215 'parent' => 'views_handler_field',
216 ),
217 'views_handler_field_locale_language' => array(
218 'parent' => 'views_handler_field',
219 ),
220 'views_handler_field_locale_link_edit' => array(
221 'parent' => 'views_handler_field',
222 ),
223 // Argument handlers.
224 'views_handler_argument_locale_group' => array(
225 'parent' => 'views_handler_argument',
226 ),
227 'views_handler_argument_locale_language' => array(
228 'parent' => 'views_handler_argument',
229 ),
230 // Filters.
231 'views_handler_filter_locale_group' => array(
232 'parent' => 'views_handler_filter_in_operator',
233 ),
234 'views_handler_filter_locale_language' => array(
235 'parent' => 'views_handler_filter_in_operator',
236 ),
237 'views_handler_filter_locale_version' => array(
238 'parent' => 'views_handler_filter_in_operator',
239 ),
240 ),
241 );
242 }
243
244 /**
245 * @}
246 */