mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 06:00:20 +00:00
70e3ec9e90
in perl... Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
24 lines
555 B
Perl
Executable file
24 lines
555 B
Perl
Executable file
#!/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";
|
|
}
|