mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-13 16:26:28 +00:00
Merge branch 'translation'
This commit is contained in:
commit
98db698ac0
4871
extras/po/de.po
4871
extras/po/de.po
File diff suppressed because it is too large
Load Diff
4873
extras/po/es.po
4873
extras/po/es.po
File diff suppressed because it is too large
Load Diff
4875
extras/po/fr.po
4875
extras/po/fr.po
File diff suppressed because it is too large
Load Diff
@ -26,18 +26,25 @@ msgstr ""
|
||||
|
||||
my @blacklist = ('"--"', '"\\\\000"', '`.*`', '$\(.*\)');
|
||||
|
||||
# Translatable strings that can't be automatically detected yet
|
||||
my %undetectable = (
|
||||
124 => '[sudo] Enter password for user ::1 user:: to gain superuser privileges'
|
||||
);
|
||||
|
||||
open my $handle, $FILE or die "Failed to open $FILE";
|
||||
my @lines = <$handle>;
|
||||
close $handle;
|
||||
|
||||
my %seen;
|
||||
my @ignored;
|
||||
my $index = 0;
|
||||
my $fold;
|
||||
my $func;
|
||||
my $force;
|
||||
my $str;
|
||||
|
||||
foreach (@lines) {
|
||||
$index++;
|
||||
$force = 0;
|
||||
|
||||
# It's a fold title
|
||||
if (m/^# +{{{ +(.*)$/) {
|
||||
@ -51,44 +58,28 @@ foreach (@lines) {
|
||||
next;
|
||||
}
|
||||
|
||||
# Force if it's undetectable
|
||||
$force = 1 if exists($undetectable{$index});
|
||||
|
||||
# Next if there is no print function
|
||||
next unless m/$FUNCPATTERN +$STRINGPATTERN/;
|
||||
next unless $force or m/$FUNCPATTERN +$STRINGPATTERN/;
|
||||
|
||||
# Next if it was seen before
|
||||
$seen{$2}++;
|
||||
next if $seen{$2} > 1;
|
||||
|
||||
# Next if it's blacklisted
|
||||
if (grep {$2 =~ m/$_/} @blacklist) {
|
||||
push @ignored, $2;
|
||||
next;
|
||||
}
|
||||
|
||||
print "#. Fold: $fold\n";
|
||||
print "#. Function: $func\n";
|
||||
print "#.\n";
|
||||
print "#. Code sample:\n";
|
||||
|
||||
my $sign = ' ';
|
||||
for (-7..3) {
|
||||
if($_ == -1) {
|
||||
$sign = '>';
|
||||
# Get string from the $undetectable hash or via regex
|
||||
if ($force) {
|
||||
$str = "\"$undetectable{$index}\"";
|
||||
}
|
||||
else {
|
||||
$sign = ' ';
|
||||
$str = $2;
|
||||
}
|
||||
|
||||
my $n = $index + $_;
|
||||
print "#. $sign $lines[$n]";
|
||||
}
|
||||
# Next if it was seen before
|
||||
$seen{$str}++;
|
||||
next if $seen{$str} > 1;
|
||||
|
||||
print "#: tomb:$index\n";
|
||||
print "msgid $2\n";
|
||||
# Next if it's blacklisted
|
||||
next if grep {$str =~ m/$_/} @blacklist;
|
||||
|
||||
print "#: tomb:$fold:$func:$index\n";
|
||||
print "msgid $str\n";
|
||||
print "msgstr \"\"\n\n";
|
||||
}
|
||||
|
||||
print STDERR "-- IGNORED\n";
|
||||
foreach (@ignored) {
|
||||
print STDERR "$_\n";
|
||||
}
|
||||
|
||||
|
4897
extras/po/ru.po
4897
extras/po/ru.po
File diff suppressed because it is too large
Load Diff
4921
extras/po/tomb.pot
4921
extras/po/tomb.pot
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user