| | |
| | | #!/usr/bin/env php |
| | | <?php |
| | | /* |
| | | |
| | | +-----------------------------------------------------------------------+ |
| | | | bin/exportgettext.sh | |
| | | | | |
| | |
| | | +-----------------------------------------------------------------------+ |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | | |
| | | $Id$ |
| | | |
| | | */ |
| | | |
| | | define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); |
| | | define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' ); |
| | | require INSTALL_PATH.'program/include/clisetup.php'; |
| | | |
| | | if ($argc < 2) { |
| | |
| | | $destdir = unslashify($argv[2]); |
| | | $layout = 'launchpad'; # or 'narro'; |
| | | $langcode_map = array( |
| | | 'hy_AM' => 'am', |
| | | 'hy_AM' => 'hy', |
| | | 'ar_SA' => 'ar', |
| | | 'az_AZ' => 'az', |
| | | 'bg_BG' => 'bg', |
| | | 'bs_BA' => 'bs', |
| | | 'ca_ES' => 'ca', |
| | | 'cs_CZ' => 'cz', |
| | | 'cs_CZ' => 'cs', |
| | | 'cy_GB' => 'cy', |
| | | 'da_DK' => 'da', |
| | | 'et_EE' => 'et', |
| | | 'el_GR' => 'el', |
| | | 'eu_ES' => 'eu', |
| | | 'fa_IR' => 'fa', |
| | | 'ga_IE' => 'ga', |
| | | 'ka_GE' => 'ge', |
| | | 'ka_GE' => 'ka', |
| | | 'gl_ES' => 'gl', |
| | | 'he_IL' => 'he', |
| | | 'hi_IN' => 'hi', |
| | |
| | | 'km_KH' => 'km', |
| | | 'ms_MY' => 'ms', |
| | | 'mr_IN' => 'mr', |
| | | 'ml_IN' => 'ml', |
| | | 'pl_PL' => 'pl', |
| | | 'si_LK' => 'si', |
| | | 'sl_SI' => 'sl', |
| | |
| | | } |
| | | else if (is_file($fn)) { |
| | | include($fn); |
| | | $texts = array_merge($texts, (array)$labels); |
| | | $texts = array_merge($texts, (array)$labels, (array)$messages); |
| | | } |
| | | |
| | | $GLOBALS['en_US'] = $texts; |
| | |
| | | } |
| | | |
| | | include($fn); |
| | | $texts = $labels ? $labels : $messages; |
| | | $texts = array_merge($labels, $messages); |
| | | |
| | | // write header |
| | | $header = <<<EOF |
| | |
| | | "Content-Transfer-Encoding: 8bit\\n" |
| | | EOF; |
| | | |
| | | $out = sprintf($header, $srcname, $product, $is_pot ? "POT-Creation-Date" : "PO-Revision-Date", date('c'), $lang); |
| | | $out = sprintf($header, $srcname, $product, $is_pot ? "POT-Creation-Date" : "PO-Revision-Date", date('c'), $shortlang ? $shortlang : $lang); |
| | | $out .= "\n"; |
| | | |
| | | $messages = array(); |
| | |
| | | $msgid = $is_pot ? $msgstr : ($GLOBALS['en_US'][$label] ?: $label); |
| | | $messages[$msgid][] = $label; |
| | | } |
| | | |
| | | |
| | | foreach ($messages as $msgid => $labels) { |
| | | $out .= "\n"; |
| | | foreach ($labels as $label) |
| | |
| | | return rtrim($out); |
| | | } |
| | | |
| | | ?> |
| | | ?> |