1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-21 11:56:04 +01:00
vichan/tools/i18n_compile.php

45 lines
1.1 KiB
PHP
Raw Normal View History

#!/usr/bin/php
<?php
/*
* i18n_compile.php - compiles the i18n
*
* Options:
* -l [locale], --locale=[locale]
* Compiles [locale] locale.
*
*/
require dirname(__FILE__) . '/inc/cli.php';
// parse command line
$opts = getopt('l:', Array('locale:'));
$options = Array();
$options['locale'] = isset($opts['l']) ? $opts['l'] : (isset($opts['locale']) ? $opts['locale'] : false);
if ($options['locale']) $locales = array($options['locale']);
else die("Error: no locales specified; use -l switch, eg. -l pl_PL\n");
foreach ($locales as $loc) {
if (file_exists ($locdir = "inc/locale/".$loc)) {
if (!is_dir ($locdir)) {
continue;
}
}
else {
die("Error: $locdir does not exist\n");
}
// Generate tinyboard.po
if (file_exists($locdir."/LC_MESSAGES/tinyboard.po")) $join = "-j";
else $join = "";
2013-07-03 07:24:09 +02:00
passthru("cd $locdir/LC_MESSAGES;
msgfmt tinyboard.po -o tinyboard.mo");
// Generate javascript.po
2013-07-03 07:24:09 +02:00
passthru("cd tools/inc/lib/jsgettext/;
php po2json.php -i ../../../../$locdir/LC_MESSAGES/javascript.po \
2013-07-03 07:24:09 +02:00
-o ../../../../$locdir/LC_MESSAGES/javascript.js");
}