1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Improved i18n-to-gettext.pl

This commit is contained in:
Klaus Schmidinger 2007-08-15 12:52:00 +02:00
parent fdcce1c153
commit 0979904dfc
3 changed files with 22 additions and 5 deletions

View File

@ -2085,6 +2085,7 @@ Tomas Berglund <tomber@telia.com>
Matthias Schwarzott <zzam@gentoo.org> Matthias Schwarzott <zzam@gentoo.org>
for suggesting to add LC_ALL to the checks for UTF-8 at startup for suggesting to add LC_ALL to the checks for UTF-8 at startup
for fixing getting the code setting from the locale for fixing getting the code setting from the locale
for improving i18n-to-gettext.pl
Martin Ostermann <martin@familie-ostermann.de> Martin Ostermann <martin@familie-ostermann.de>
for fixing processing the PDCDescriptor in 'libsi' on big endian systems for fixing processing the PDCDescriptor in 'libsi' on big endian systems

View File

@ -5346,8 +5346,9 @@ Video Disk Recorder Revision History
- Added a debug error message to cReceiver::~cReceiver() in case it is still - Added a debug error message to cReceiver::~cReceiver() in case it is still
attached to a device (thanks to Reinhard Nissl). attached to a device (thanks to Reinhard Nissl).
2007-08-12: Version 1.5.8 2007-08-15: Version 1.5.8
- Added missing install-i18n to the install target in the Makefile (reported - Added missing install-i18n to the install target in the Makefile (reported
by Joachim Wilke). by Joachim Wilke).
- Fixed a faulty comment in Make.config.template (reported by Marco Schlüßler). - Fixed a faulty comment in Make.config.template (reported by Marco Schlüßler).
- Improved i18n-to-gettext.pl (thanks to Matthias Schwarzott).

View File

@ -10,7 +10,7 @@
# See the main source file 'vdr.c' for copyright information and # See the main source file 'vdr.c' for copyright information and
# how to reach the author. # how to reach the author.
# #
# $Id: i18n-to-gettext.pl 1.2 2007/08/12 10:02:01 kls Exp $ # $Id: i18n-to-gettext.pl 1.3 2007/08/15 12:52:00 kls Exp $
# How to convert an actual plugin: # How to convert an actual plugin:
# #
@ -75,7 +75,7 @@ die "can't find plugin name!" unless ($PLUGIN);
# Locate the file containing the texts: # Locate the file containing the texts:
$I18NFILE = ""; $I18NFILE = "";
for ("i18n.c", `ls *.c`) { # try i18n.c explicitly first for ("i18n.c", "i18n.h", `ls *.c`) { # try i18n.[ch] explicitly first
chomp($f = $_); chomp($f = $_);
if (-f $f && `grep tI18nPhrase $f`) { if (-f $f && `grep tI18nPhrase $f`) {
$I18NFILE = $f; $I18NFILE = $f;
@ -204,13 +204,28 @@ $POTFILE = "$PODIR/$PLUGIN.pot";
# Collect all translated texts: # Collect all translated texts:
open(F, $I18NFILE) || die "$I18NFILE: $!\n"; open(F, $I18NFILE) || die "$I18NFILE: $!\n";
$InComment = 0;
while (<F>) { while (<F>) {
chomp; chomp;
s/\t/ /g; # get rid of tabs s/\t/ /g; # get rid of tabs
s/ *$//; # get rid of trailing blanks s/ *$//; # get rid of trailing blanks
s/^ *\/\/.*//; # remove comment lines s/^ *\/\/.*//; # remove comment lines
s/, *\/\/.*/,/; # strip trailing comments s/ *\/\/.*//; # strip trailing comments
s/\/\*.*\*\///g; # strip c comments
if (/\/\*/) {
$InComment = 1;
s/\/\*.*$//; # remove start of comment
}
elsif (/\*\//) {
$InComment = 0;
s/^.*\*\///; # remove end of comment
}
elsif ($InComment) {
next;
}
next if (/^ *$/); # skip empty lines next if (/^ *$/); # skip empty lines
next if (/#if/);
next if (/#endif/);
next unless ($found or $found = /const *tI18nPhrase .*{/); # sync on phrases next unless ($found or $found = /const *tI18nPhrase .*{/); # sync on phrases
next if (/const *tI18nPhrase .*{/); # skip sync line next if (/const *tI18nPhrase .*{/); # skip sync line
last if (/{ *NULL *}/); # stop after last phrase last if (/{ *NULL *}/); # stop after last phrase
@ -324,7 +339,7 @@ while (<OLD>) {
$_ .= " i18n"; $_ .= " i18n";
} }
elsif (/^clean:/) { elsif (/^clean:/) {
$_ .= "\n\t\@-rm -f \$(PODIR)/*.mo \$(PODIR)/*.pot"; $_ .= "\n\t\@-rm -f \$(PODIR)/*.mo \$(PODIR)/*.pot";
} }
print NEW "$_\n"; print NEW "$_\n";
} }