summaryrefslogtreecommitdiffstats
path: root/tdeprint/cups/cupsdconf2/cupsdcomment.pl
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
commite16866e072f94410321d70daedbcb855ea878cac (patch)
treeee3f52eabde7da1a0e6ca845fb9c2813cf1558cf /tdeprint/cups/cupsdconf2/cupsdcomment.pl
parenta58c20c1a7593631a1b50213c805507ebc16adaf (diff)
downloadtdelibs-e16866e072f94410321d70daedbcb855ea878cac.tar.gz
tdelibs-e16866e072f94410321d70daedbcb855ea878cac.zip
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'tdeprint/cups/cupsdconf2/cupsdcomment.pl')
-rw-r--r--tdeprint/cups/cupsdconf2/cupsdcomment.pl61
1 files changed, 61 insertions, 0 deletions
diff --git a/tdeprint/cups/cupsdconf2/cupsdcomment.pl b/tdeprint/cups/cupsdconf2/cupsdcomment.pl
new file mode 100644
index 000000000..b3da5ee7e
--- /dev/null
+++ b/tdeprint/cups/cupsdconf2/cupsdcomment.pl
@@ -0,0 +1,61 @@
+#!/usr/bin/perl -w
+#
+# Filter to extract comments for translation from cupsd.conf.template
+#
+# This code should produce strings identical to tooltips in cupsdcomment.cpp
+#
+my ($comment_, $example_);
+$example_ = "";
+
+load(); # Skip header
+
+while ( <STDIN> )
+{
+ if(load())
+ {
+ print toolTip();
+ }
+}
+
+# Corresponds to Comment::load in cupsdcomment.cpp
+sub load
+{
+ $comment_ = "";
+ my($current) = \$comment_;
+ while ( <STDIN> )
+ {
+ if (/^\$\$/)
+ {
+ $current = \$example_;
+ }
+ elsif (/^\%\%/)
+ {
+ next; # Do nothing
+ }
+ elsif (/^\@\@/)
+ {
+ return 1;
+ }
+ elsif (/^[\s]*$/)
+ {
+ next; # Do nothing
+ }
+ else
+ {
+ last if (!/^\#/);
+ ${$current} = ${$current} . $_;
+ }
+ }
+ return 0;
+}
+
+# Corresponds to Comment::toolTip in cupsdcomment.cpp
+sub toolTip
+{
+ my($str) = $comment_;
+ $str =~ s/\"/\\\"/g;
+ $str =~ s/^\#[\s]*/i18n\(\"Do not translate the keyword between brackets \(e\.g\. ServerName, ServerAdmin, etc\.\)\",\"/;
+ $str =~ s/\n\#[\s]*/\\n\"\n\"/g;
+ $str =~ s/\n$/\\n\"\n\)\;\n\n/;
+ return $str;
+}