mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
67 lines
998 B
Text
67 lines
998 B
Text
![]() |
#! /usr/bin/perl
|
||
|
# little script to extract the text from the tips file
|
||
|
# and output it, so xgettext can add the tips to the po file
|
||
|
#
|
||
|
# 2000 by Matthias Kiefer <matthias.kiefer@gmx.de>
|
||
|
|
||
|
# IMPORTANT NOTE: Do not change the output without checking if
|
||
|
# translations still work!
|
||
|
|
||
|
sub printText
|
||
|
{
|
||
|
my $text = $_[0];
|
||
|
|
||
|
if ( $text cmp "" )
|
||
|
{
|
||
|
|
||
|
# replace \ with \\
|
||
|
$text =~ s/\\/\\\\/g;
|
||
|
|
||
|
# replace " with \"
|
||
|
$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);
|