aboutsummaryrefslogtreecommitdiff
path: root/actions/merge.php
blob: db1e75276adffa1cca76fce8e1267b4cad4a4ffb (plain)
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
<?php 
	gatekeeper();
	
	$current_language = get_input("current_language");
	$plugin = get_input("plugin");
	
	if(translation_editor_is_translation_editor()){
		
		// We'll be outputting a CSV
		header("Content-Type: text/plain");
			
		// It will be called $lang.php
		header('Content-Disposition: attachment; filename="' . $current_language . '.php"');
		
		$translation = translation_editor_get_plugin($current_language, $plugin);
		$translation = $translation['current_language'];
		
		echo "<?php" . PHP_EOL;
		echo '$language = ';
		echo var_export($translation);
		echo ';' . PHP_EOL;
		echo 'add_translation("' . $current_language . '", $language);'  . PHP_EOL;
		
		exit();
		
	} else {
		register_error(elgg_echo("transation_editor:action:translate:error:not_authorized"));
		forward(REFERER);
	}