summaryrefslogtreecommitdiffstats
path: root/modules-available/main/hooks/translation.inc.php
blob: c831cbfdc1f9a13ab3e086f1486dae09b1d6a3d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

$HANDLER = array();

/**
 * List of valid subsections
 */
$HANDLER['subsections'] = array(
	'categories', 'global-tags'
);

/*
 * Handlers for the subsections that will return an array of expected tags.
 * This is optional, if you don't want to define expected tags, don't create a function.
 */

/**
 * Configuration categories
 */
$HANDLER['grep_categories'] = function($module) {
	$skip = strlen($module->getIdentifier()) + 1;
	$want = array();
	foreach (Module::getAll() as $module) {
		$cat = $module->getCategory();
		if (is_string($cat)) {
			$want[substr($cat, $skip)] = true;
		}
	}
	return $want;
};

/**
 * Global tags.
 * This just returns the union of global tags of all languages, as there is no
 * way to define a definite set of required global tags.
 */
$HANDLER['grep_global-tags'] = function($module) {
	$want = array();
	foreach (Dictionary::getLanguages() as $lang) {
		$want += Dictionary::getArray($module->getIdentifier(), 'global-tags', $lang);
	}
	return $want;
};