diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch) | |
tree | 5ac38a06f3dde268dc7927dc155896926aaf7012 /kdeprint/cups/cupsdconf2/cupsdcomment.pl | |
download | tdelibs-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 'kdeprint/cups/cupsdconf2/cupsdcomment.pl')
-rw-r--r-- | kdeprint/cups/cupsdconf2/cupsdcomment.pl | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/kdeprint/cups/cupsdconf2/cupsdcomment.pl b/kdeprint/cups/cupsdconf2/cupsdcomment.pl new file mode 100644 index 000000000..b3da5ee7e --- /dev/null +++ b/kdeprint/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; +} |