diff --git a/include/cli/modules/i18n.php b/include/cli/modules/i18n.php index f4c06caec1e1c34e7cb615ccb78957256b1a97b5..0931361dde1a861f190bd4199a78306fa763398c 100644 --- a/include/cli/modules/i18n.php +++ b/include/cli/modules/i18n.php @@ -40,6 +40,10 @@ class i18n_Compiler extends Module { 'help' => 'Add a domain to the path/context of PO strings'), 'dns' => array('-d', '--dns', 'default' => false, 'metavar' => 'zone-id', 'help' => 'Write signature to DNS (via this AWS HostedZoneId)'), + 'zlib' => array('-z', '--zlib', 'default' => false, + 'action' => 'store_true', 'help' => 'Compress PHAR with zlib'), + 'bzip2' => array('-j', '--bzip2', 'default' => false, + 'action' => 'store_true', 'help' => 'Compress PHAR with bzip2'), ); var $epilog = "Note: If updating DNS, you will need to set @@ -100,7 +104,7 @@ class i18n_Compiler extends Module { $this->fail('API key is required'); if (!$options['lang']) $this->fail('Language code is required. See `list`'); - $this->_build($options['lang']); + $this->_build($options['lang'], $options); break; case 'similar': $this->find_similar($options); @@ -146,7 +150,7 @@ class i18n_Compiler extends Module { } } - function _build($lang) { + function _build($lang, $options) { list($code, $zip) = $this->_request("download/$lang.zip"); if ($code !== 200) @@ -164,6 +168,10 @@ class i18n_Compiler extends Module { @unlink(I18N_DIR."$lang.phar"); $phar = new Phar(I18N_DIR."$lang.phar"); $phar->startBuffering(); + if ($options['zlib']) + $phar->compress(Phar::GZ, 'phar'); + if ($options['bzip2']) + $phar->compress(Phar::BZ2, 'phar'); $po_file = false; @@ -190,9 +198,9 @@ class i18n_Compiler extends Module { } foreach ($langs as $l) { list($code, $js) = $this->_http_get( - 'http://imperavi.com/webdownload/redactor/lang/?lang=' - .strtolower($l)); - if ($code == 200 && ($js != 'File not found')) { + sprintf('https://imperavi.com/download/redactor/langs/%s/', + strtolower($l))); + if ($code == 200 && strlen($js) > 100) { $phar->addFromString('js/redactor.js', $js); break; } @@ -277,7 +285,9 @@ class i18n_Compiler extends Module { $po_header = Mail_Parse::splitHeaders($mo['']); $info = array( 'Build-Date' => date(DATE_RFC822), + 'Phrases-Version' => $po_header['X-Osticket-Major-Version'], 'Build-Version' => trim(`git describe`), + 'Build-Major-Version' => MAJOR_VERSION, 'Language' => $po_header['Language'], #'Phrases' => #'Translated' =>