summaryrefslogtreecommitdiffstats
path: root/kdeui/preparetips
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdeui/preparetips
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeui/preparetips')
-rwxr-xr-xkdeui/preparetips66
1 files changed, 66 insertions, 0 deletions
diff --git a/kdeui/preparetips b/kdeui/preparetips
new file mode 100755
index 000000000..baeaaf3b4
--- /dev/null
+++ b/kdeui/preparetips
@@ -0,0 +1,66 @@
+#! /usr/bin/perl
+# little script to extract the text from the tips file
+# and output it, so xgettext can add the tips to the po file
+#
+# 2000 by Matthias Kiefer <matthias.kiefer@gmx.de>
+
+# IMPORTANT NOTE: Do not change the output without checking if
+# translations still work!
+
+sub printText
+{
+ my $text = $_[0];
+
+ if ( $text cmp "" )
+ {
+
+ # replace \ with \\
+ $text =~ s/\\/\\\\/g;
+
+ # replace " with \"
+ $text =~ s/"/\\"/g;
+
+ print "\"$text\\n\"\n";
+ }
+}
+
+open(FILE,"<","tips") or die "unable to open tips file";
+if ( $^V ge v5.8.0 )
+{
+ binmode(FILE,":utf8");
+ binmode(STDOUT,":utf8");
+}
+
+$inTip=0;
+
+while(<FILE>)
+{
+ chomp;
+
+ # tip starts with <html>
+ if(/^\s*<html>(.*)/io)
+ {
+ $inTip=1;
+ print "//i18n file tips.cpp line $.\n";
+ print "i18n(\n";
+ printText($1);
+ next;
+ }
+
+ if($inTip!=0)
+ {
+ # tip ends with </html>
+ if(/^(.*)\s*<\/html>/io)
+ {
+ printText($1);
+ print ");\n\n";
+ $inTip=0;
+ }
+ else
+ {
+ printText($_);
+ }
+ }
+}
+
+close(FILE);