From 70e3ec9e90e33a2f11e500e1a1c807ab58b4ebe1 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Tue, 3 May 2016 18:14:41 +0200 Subject: A script to find literal texts to be marked for translation in qml in perl... Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- scripts/translationmark.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 scripts/translationmark.pl (limited to 'scripts') 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 () { + 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"; +} -- cgit v1.2.3-70-g09d2