improve scoring to store to presubmitted localhost, fix style and
[ViQa-Kissu.git] / tools / i18n_compile.php
blobba193767be07273107be5527b92ff62b133a4e38
1 #!/usr/bin/php
2 <?php
4 /*
5 * i18n_compile.php - compiles the i18n
7 * Options:
8 * -l [locale], --locale=[locale]
9 * Compiles [locale] locale.
13 require dirname(__FILE__) . '/inc/cli.php';
15 // parse command line
16 $opts = getopt('l:', Array('locale:'));
17 $options = Array();
19 $options['locale'] = isset($opts['l']) ? $opts['l'] : (isset($opts['locale']) ? $opts['locale'] : false);
21 if ($options['locale']) $locales = array($options['locale']);
22 else die("Error: no locales specified; use -l switch, eg. -l pl_PL\n");
24 foreach ($locales as $loc) {
25 if (file_exists ($locdir = "inc/locale/".$loc)) {
26 if (!is_dir ($locdir)) {
27 continue;
30 else {
31 die("Error: $locdir does not exist\n");
34 // Generate tinyboard.po
35 if (file_exists($locdir."/LC_MESSAGES/tinyboard.po")) $join = "-j";
36 else $join = "";
37 passthru("cd $locdir/LC_MESSAGES;
38 msgfmt tinyboard.po -o tinyboard.mo");
40 // Generate javascript.po
41 passthru("cd tools/inc/lib/jsgettext/;
42 php po2json.php -i ../../../../$locdir/LC_MESSAGES/javascript.po \
43 -o ../../../../$locdir/LC_MESSAGES/javascript.js");