mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdeui: rewrite preparetips as shell script
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
853f83b52b
commit
5916fef870
3 changed files with 19 additions and 66 deletions
|
@ -45,13 +45,6 @@ if(UNIX AND Q_WS_X11)
|
||||||
endif(UNIX AND Q_WS_X11)
|
endif(UNIX AND Q_WS_X11)
|
||||||
|
|
||||||
# required features
|
# required features
|
||||||
find_package(Perl)
|
|
||||||
set_package_properties(Perl PROPERTIES
|
|
||||||
URL "http://www.perl.org"
|
|
||||||
TYPE RUNTIME
|
|
||||||
PURPOSE "Needed for KDEUI preparetips script"
|
|
||||||
)
|
|
||||||
|
|
||||||
find_package(ZLIB)
|
find_package(ZLIB)
|
||||||
set_package_properties(ZLIB PROPERTIES
|
set_package_properties(ZLIB PROPERTIES
|
||||||
DESCRIPTION "Support for gzip compressed files and data streams"
|
DESCRIPTION "Support for gzip compressed files and data streams"
|
||||||
|
|
|
@ -20,7 +20,7 @@ build_script:
|
||||||
|
|
||||||
sudo apt-get install -qq cmake katie-dev libenchant-dev \
|
sudo apt-get install -qq cmake katie-dev libenchant-dev \
|
||||||
libopenexr-dev libmpv-dev libraw-dev xorg-dev mesa-common-dev \
|
libopenexr-dev libmpv-dev libraw-dev xorg-dev mesa-common-dev \
|
||||||
libavahi-common-dev krb5-multidev perl-base libwebp-dev \
|
libavahi-common-dev krb5-multidev libwebp-dev \
|
||||||
libudev-dev liblzma-dev libexiv2-dev libilmbase-dev libjpeg-dev \
|
libudev-dev liblzma-dev libexiv2-dev libilmbase-dev libjpeg-dev \
|
||||||
libbz2-dev libattr1-dev libacl1-dev libxcb-render-util0-dev \
|
libbz2-dev libattr1-dev libacl1-dev libxcb-render-util0-dev \
|
||||||
libxcb-keysyms1-dev libxcb-image0-dev libcdio-dev strigi \
|
libxcb-keysyms1-dev libxcb-image0-dev libcdio-dev strigi \
|
||||||
|
|
|
@ -1,66 +1,26 @@
|
||||||
#! /usr/bin/perl
|
#!/bin/sh
|
||||||
|
|
||||||
# little script to extract the text from the tips file
|
# little script to extract the text from the tips file
|
||||||
# and output it, so xgettext can add the tips to the po file
|
# and output it, so xgettext can add the tips to the po file
|
||||||
#
|
#
|
||||||
# 2000 by Matthias Kiefer <matthias.kiefer@gmx.de>
|
# 2021 by Ivailo Monev <xakepa10@gmail.com>
|
||||||
|
|
||||||
# IMPORTANT NOTE: Do not change the output without checking if
|
# IMPORTANT NOTE: Do not change the output without checking if
|
||||||
# translations still work!
|
# translations still work!
|
||||||
|
|
||||||
sub printText
|
intip="no"
|
||||||
{
|
while read line;do
|
||||||
my $text = $_[0];
|
if echo "$line" | grep -q '<html>';then
|
||||||
|
intip="yes"
|
||||||
if ( $text cmp "" )
|
echo "// i18n: ectx: @info:tipoftheday";
|
||||||
{
|
printf "i18n(";
|
||||||
|
continue
|
||||||
|
elif echo "$line" | grep -q '</html>';then
|
||||||
|
intip="no"
|
||||||
|
echo ");";
|
||||||
|
fi
|
||||||
|
|
||||||
# replace \ with \\
|
if [ "$intip" = "yes" ];then
|
||||||
$text =~ s/\\/\\\\/g;
|
echo "\""$(echo "$line" | sed -e 's|"|\\"|g' -e 's|\\|\\\\|g')"\\\n\""
|
||||||
|
fi
|
||||||
# replace " with \"
|
done < tips
|
||||||
$text =~ s/"/\\"/g;
|
|
||||||
|
|
||||||
print "\"$text\\n\"\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open(FILE,"<","tips") or die "unable to open tips file";
|
|
||||||
if ( $^V ge v5.8.0 )
|
|
||||||
{
|
|
||||||
binmode(FILE,":utf8");
|
|
||||||
binmode(STDOUT,":utf8");
|
|
||||||
}
|
|
||||||
|
|
||||||
$inTip=0;
|
|
||||||
|
|
||||||
while(<FILE>)
|
|
||||||
{
|
|
||||||
chomp;
|
|
||||||
|
|
||||||
# tip starts with <html>
|
|
||||||
if(/^\s*<html>(.*)/io)
|
|
||||||
{
|
|
||||||
$inTip=1;
|
|
||||||
print "// i18n: file: tips:$.\n// i18n: ectx: \@info:tipoftheday\n";
|
|
||||||
print "i18n(";
|
|
||||||
printText($1);
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($inTip!=0)
|
|
||||||
{
|
|
||||||
# tip ends with </html>
|
|
||||||
if(/^(.*)\s*<\/html>/io)
|
|
||||||
{
|
|
||||||
printText($1);
|
|
||||||
print ");\n\n";
|
|
||||||
$inTip=0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printText($_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
close(FILE);
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue