mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Have pocheck.pl check for missing arguments, like %1$s, etc.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38263 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
772262ca3d
commit
1856b0a6df
@ -45,7 +45,7 @@ foreach $pofilename ( @ARGV )
|
|||||||
$msgid = $msgid . $more;
|
$msgid = $msgid . $more;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
# now look for the associated msgstr.
|
# now look for the associated msgstr.
|
||||||
until ( ( $msgstr ) = ( $pofile[$i] =~ m/^msgstr "(.*)"/ ) ) { $i++; };
|
until ( ( $msgstr ) = ( $pofile[$i] =~ m/^msgstr "(.*)"/ ) ) { $i++; };
|
||||||
$i++;
|
$i++;
|
||||||
@ -60,6 +60,25 @@ foreach $pofilename ( @ARGV )
|
|||||||
# (surely that is always $msgstr?)
|
# (surely that is always $msgstr?)
|
||||||
next if ($msgid eq "" or $msgstr eq "");
|
next if ($msgid eq "" or $msgstr eq "");
|
||||||
|
|
||||||
|
# Check for matching %1$s, etc.
|
||||||
|
@argstrs = ( $msgid =~ m/%(\d)\$s/g );
|
||||||
|
if (@argstrs) {
|
||||||
|
$num = 0;
|
||||||
|
foreach $arg (@argstrs) { $num = $arg if $arg > $num; }
|
||||||
|
if ($num <= 0) {
|
||||||
|
print "Problem finding arguments in:\n $msgid!\n";
|
||||||
|
$warn++;
|
||||||
|
} else {
|
||||||
|
foreach $i (1..$num) {
|
||||||
|
$arg = "%$i\\\$s";
|
||||||
|
if ( $msgstr !~ m/$arg/ ) {
|
||||||
|
print "Missing argument `$arg'\n '$msgid' ==> '$msgstr'\n";
|
||||||
|
$warn++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Check colon at the end of a message
|
# Check colon at the end of a message
|
||||||
if ( ( $msgid =~ m/: *(\|.*)?$/ ) != ( $msgstr =~ m/: *(\|.*)?$/ ) ) {
|
if ( ( $msgid =~ m/: *(\|.*)?$/ ) != ( $msgstr =~ m/: *(\|.*)?$/ ) ) {
|
||||||
print( "Missing or unexpected colon:\n" );
|
print( "Missing or unexpected colon:\n" );
|
||||||
@ -94,7 +113,7 @@ foreach $pofilename ( @ARGV )
|
|||||||
print( " '$msgid' => '$msgstr'\n" );
|
print( " '$msgid' => '$msgstr'\n" );
|
||||||
$warn++;
|
$warn++;
|
||||||
}
|
}
|
||||||
|
|
||||||
# we now collect these translations in a hash.
|
# we now collect these translations in a hash.
|
||||||
# this will allow us to check below if we have translated
|
# this will allow us to check below if we have translated
|
||||||
# anything more than one way.
|
# anything more than one way.
|
||||||
|
Loading…
Reference in New Issue
Block a user