diff options
author | Robert C. Helling <helling@atdotde.de> | 2016-05-03 18:14:41 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-05-03 12:58:55 -0700 |
commit | 70e3ec9e90e33a2f11e500e1a1c807ab58b4ebe1 (patch) | |
tree | c60acaf133bb36608f51f71d7e6452981fbfc28a /scripts | |
parent | 17355c99ff9acd67699ac95578ded88262c4287c (diff) | |
download | subsurface-70e3ec9e90e33a2f11e500e1a1c807ab58b4ebe1.tar.gz |
A script to find literal texts to be marked for translation in qml
in perl...
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/translationmark.pl | 24 |
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"; +} |