summaryrefslogtreecommitdiffstats
path: root/pot/extractrc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-10 05:14:00 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-10 05:14:00 +0000
commitfa949b6b7fa553547f26305d4227e8baa0091c1f (patch)
tree9199255f7d3e0f276f6f53000f13fb0081f3c4c5 /pot/extractrc
downloadbibletime-fa949b6b7fa553547f26305d4227e8baa0091c1f.tar.gz
bibletime-fa949b6b7fa553547f26305d4227e8baa0091c1f.zip
Added initial Trinity version of BibleTime
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/bibletime@1173688 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'pot/extractrc')
-rw-r--r--pot/extractrc74
1 files changed, 74 insertions, 0 deletions
diff --git a/pot/extractrc b/pot/extractrc
new file mode 100644
index 0000000..368849d
--- /dev/null
+++ b/pot/extractrc
@@ -0,0 +1,74 @@
+#! /usr/bin/perl
+
+# NOTE: this script is part of the KDE SDK and added to KDevelop to support KDE 2 application development.
+# The original is located in the KDE CVS module kdesdk/scripts. It gets installed in the same directory as
+# the KDevelop binary to be in your PATH.
+#
+# What it does is extract the strings in an application�s .rc file, e.g. testappui.rc, and writes into the pot file
+# where the translations are build with (po-files)
+#
+# Added to KDevelop 2000-10-29, Ralf Nolden ([email protected])
+
+$linenr = 0;
+$filename = "";
+@filenames = ();
+
+sub writeoutstring($)
+{
+ print STDOUT "i18n(\"@_[0]\");\n";
+}
+
+while (defined ($ARGV[0]))
+{
+ $_ = shift;
+ $filename = $_; # maybe check for options
+
+if (! $filename) {
+ print STDERR "no file to open\n";
+ exit 1;
+}
+
+$string = "";
+$intext = 0;
+
+open(FILE, $filename);
+while ( <FILE> ) {
+ $linenr++;
+
+ $string .= $_;
+ chomp($string);
+
+ $textstring = '([tT][eE][xX][tT]|string)>';
+
+ if ($intext == 0) {
+ if ($string =~ /<$textstring/) {
+ $string =~ s/^.*<$textstring//;
+ $intext = 1;
+ $starting_linenr = $linenr;
+ } else {
+ $string = "";
+ }
+ }
+
+ if (($intext == 1) && ($string =~ /<\/$textstring/)) {
+ my $text = $string;
+ $text =~ s/<\/$textstring.*$//;
+ $text =~ s/&lt;/</g;
+ $text =~ s/&gt;/>/g;
+ $text =~ s/&amp;/&/g;
+ writeoutstring($text);
+ $string =~ s/^.*<\/$textstring//;
+ $intext = 0;
+ if ($linenr != $starting_linenr) {
+ print STDERR "there is <text> floating\n";
+ }
+ }
+
+}
+
+if ($intext == 1) {
+ print STDERR "parsing error in $filename $linenr\n";
+ exit 1;
+}
+
+}