Bug#1098919: Help to improve comparison in english/international/l10n/scripts/gen-files.pl
"Vladimir L." <[email protected]>
| Newsgroups | gmane.linux.debian.devel.www |
|---|---|
| Message-ID | <20250430144339.b36134af7ed7d2778742a7e4__14403.620145616$1745997687$gmane$org@list.ru> |
Hello. The problem is that the regular expression in "transmonitor-check" can't match multiple lines. To fix that you have to use the "/s" modifier. But now "(.*)" will match everything after "Language-Team:" until the last "\n", that is, until the end of the po file header. To fix that you have to use a question mark, in which case ".*" will make the shortest match. You also have to remove quotes and line breaks from the language team address with `$langteam =~ s/"\n"//g`. I used this for testing. ---------- use strict; use warnings; my $langteam = ""; my @headers; $headers[0] = '"Project-Id-Version: project\n" "Language-Team: Brazilian Portuguese <[email protected]>\n" "Content-Type: text/plain; charset=UTF-8\n"'; $headers[1] = '"Project-Id-Version: project\n" "Language-Team: Brazilian Portuguese <debian-l10n-" "[email protected]>\n" "Content-Type: text/plain; charset=UTF-8\n"'; $headers[2] = '"Project-Id-Version: project\n" "Language-Team: Brazilian Portuguese <debian-l10n-" "[email protected]." "org>\n" "Content-Type: text/plain; charset=UTF-8\n"'; foreach (@headers) { if (m/^"Language-Team:\s*(.*?)\\n.*"$/ms) { $langteam = $1 || ''; $langteam =~ s/"\n"//g; } print("$langteam\n"); } ---------- This is a patch. ---------- --- a/transmonitor-check +++ b/transmonitor-check @@ -710,9 +710,10 @@ $lasttrans =~ s/!//g; $lasttrans = '' if $lasttrans =~ m/EMAIL\@ADDRESS/; } - if (m/^"Language-Team:\s*(.*)\\n.*"$/m) { + if (m/^"Language-Team:\s*(.*?)\\n.*"$/ms) { $langteam = $1 || ''; $langteam =~ s/!//g; + $langteam =~ s/"\n"//g; $langteam = '' if $langteam =~ m/<LL\@li.org>/; } if (m/^"Content-Type:.*charset=(.*)\\n.*"\s*$/m) { ---------- BTW, the "Last-Translator" and "Content-Type" fields are also affected by this problem. Fix is similar.