forked from ulbpodcast/ezrecorder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli_template_generate.php
More file actions
executable file
·40 lines (31 loc) · 1.03 KB
/
Copy pathcli_template_generate.php
File metadata and controls
executable file
·40 lines (31 loc) · 1.03 KB
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
<?php
/*
* This is a CLI script that compiles the templates in $tmpl_source into a specific language
* Usage: template_generate.php $tmpl_source $language
*
* Note: you can add languages by editing config.inc
*/
require_once 'global_config.inc';
require_once 'lib_template.php';
//
// Inits and sanity checks
//
if ($argc != 4) {
echo 'Usage: cli_template_generate.php <source_folder> <language> <output_folder>' . PHP_EOL;
die;
}
$source_folder = $argv[1];
$lang = $argv[2];
$output_folder = $argv[3];
echo 'Translation of *all* templates in ' . $source_folder . ' will now start.' . PHP_EOL;
echo 'Output language: ' . $lang . PHP_EOL . PHP_EOL;
template_set_errors_visible();
template_set_warnings_visible();
$res = template_generate($source_folder, $lang, $output_folder, $error);
if(!$res) {
echo $error . PHP_EOL;
die;
}
if (template_last_error() != '' || template_last_warning() != '')
echo PHP_EOL;
echo 'Translation finished, you can find your files in \'' . $output_folder . '/' . $lang . '\'' . PHP_EOL;