summaryrefslogtreecommitdiff
path: root/bin/exportgettext.sh
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-12-07 14:26:59 +0000
committerthomascube <thomas@roundcube.net>2011-12-07 14:26:59 +0000
commit7d84ff643abcb3d818260c240dc9d51dade5a835 (patch)
treea0d29e55c167e18a78560a929472fcad01b875a9 /bin/exportgettext.sh
parent6943b3f74099ca71934dd2c27a726a69aeb4c729 (diff)
Improve gettext exporter to correctly convert a single directory
Diffstat (limited to 'bin/exportgettext.sh')
-rwxr-xr-xbin/exportgettext.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/exportgettext.sh b/bin/exportgettext.sh
index 9a935dab4..8845f8920 100755
--- a/bin/exportgettext.sh
+++ b/bin/exportgettext.sh
@@ -43,9 +43,12 @@ if (is_dir($srcdir.'/en_US')) {
}
}
}
-// converting plugin localization
+// converting single localization directory
else if (is_dir($srcdir)) {
- load_en_US($srcdir.'/en_US.inc');
+ if (is_file($srcdir.'/en_US.inc')) // plugin localization
+ load_en_US($srcdir.'/en_US.inc');
+ else
+ load_en_US(realpath($srcdir.'/../en_US')); // single language
convert_dir($srcdir, $destdir);
}
// converting a single file
@@ -149,8 +152,7 @@ msgid ""
msgstr ""
"Project-Id-Version: %s\\n"
"Report-Msgid-Bugs-To: \\n"
-"POT-Creation-Date: %s\\n"
-"PO-Revision-Date: %s\\n"
+"%s: %s\\n"
"Last-Translator: \\n"
"Language-Team: Translations <hello@roundcube.net>\\n"
"Language: %s\\n"
@@ -158,12 +160,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\\n"
EOF;
- $out = sprintf($header, $srcname, $product, date('c'), date('c'), $lang);
+ $out = sprintf($header, $srcname, $product, $is_pot ? "POT-Creation-Date" : "PO-Revision-Date", date('c'), $lang);
$out .= "\n";
$messages = array();
foreach ((array)$texts as $label => $msgstr) {
- $msgid = $GLOBALS['en_US'][$label] ?: $label;
+ $msgid = $is_pot ? $msgstr : ($GLOBALS['en_US'][$label] ?: $label);
$messages[$msgid][] = $label;
}