summaryrefslogtreecommitdiffstats
path: root/scripts/translationmark.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/translationmark.pl')
-rwxr-xr-xscripts/translationmark.pl24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/translationmark.pl b/scripts/translationmark.pl
new file mode 100755
index 000000000..b206ed12f
--- /dev/null
+++ b/scripts/translationmark.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/env perl
+
+# This script expects filenames on the command line and looks up text: tags in qml files and tries to wrap them with qsTr
+
+foreach $filename (@ARGV) {
+ next unless $filename =~ /qml$/;
+ open IN, $filename;
+ open OUT, ">$filename.bak";
+ while (<IN>) {
+ if (/text:/ && !/qsTr/) {
+ if (/text:\s+(\"[^\"]*\")\s*$/) {
+ print OUT "$`text: qsTr($1)$'\n";
+ } else {
+ print OUT ">>>>$_";
+ print "$filename: $_";
+ }
+ } else {
+ print OUT;
+ }
+ }
+ close IN;
+ close OUT;
+ system "mv $filename.bak $filename";
+}