[Scummvm-git-logs] scummvm-tools master -> 8c9fd4a448645372889c9fa4bec52ac879c8cfaa
sev-
sev at scummvm.org
Sat Dec 12 12:46:16 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm-tools' repo located at https://github.com/scummvm/scummvm-tools .
Summary:
402fca1dfb PETKA: Insert chapter name to the generated .po file
74fe684909 PETKA: Added tool for generating POT and PO files
8c9fd4a448 PETKA: Added potmode to po-merge tool
Commit: 402fca1dfbd554edaf9e4ac1aa994b64227f661a
https://github.com/scummvm/scummvm-tools/commit/402fca1dfbd554edaf9e4ac1aa994b64227f661a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-12-11T23:11:03+01:00
Commit Message:
PETKA: Insert chapter name to the generated .po file
Changed paths:
engines/petka/p12explore.py
diff --git a/engines/petka/p12explore.py b/engines/petka/p12explore.py
index 990c6ea47..fda5cf163 100755
--- a/engines/petka/p12explore.py
+++ b/engines/petka/p12explore.py
@@ -2250,18 +2250,18 @@ class App(TkBrowser):
msgid = text, msgstr = ts, comment = cmt)
po.append(entry)
for rec in self.sim.objects:
- saveitem(rec.name, "obj_{}".format(rec.idx))
+ saveitem(rec.name, "p_{}_{} obj_{}".format(self.sim.curr_part, self.sim.curr_chap, rec.idx))
for rec in self.sim.scenes:
- saveitem(rec.name, "scn_{}".format(rec.idx))
+ saveitem(rec.name, "p_{}_{} scn_{}".format(self.sim.curr_part, self.sim.curr_chap, rec.idx))
for idx, name in enumerate(self.sim.namesord):
saveitem(self.sim.names[name],
- "name_{}, {}".format(idx, name))
+ "p_{}_{} name_{}, {}".format(self.sim.curr_part, self.sim.curr_chap, idx, name))
for idx, name in enumerate(self.sim.invntrord):
saveitem(self.sim.invntr[name],
- "inv_{}, {}".format(idx, name))
+ "p_{}_{} inv_{}, {}".format(self.sim.curr_part, self.sim.curr_chap, idx, name))
for idx, msg in enumerate(self.sim.msgs):
saveitem(msg.name,
- "msg_{}, {} - {}".format(idx, msg.obj.idx, msg.obj.name))
+ "p_{}_{} msg_{}, {} - {}".format(self.sim.curr_part, self.sim.curr_chap, idx, msg.obj.idx, msg.obj.name))
po.save(fn)
except:
self.switch_view(0)
Commit: 74fe6849098037bb0550366df70321c0939f9df8
https://github.com/scummvm/scummvm-tools/commit/74fe6849098037bb0550366df70321c0939f9df8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-12-12T13:42:28+01:00
Commit Message:
PETKA: Added tool for generating POT and PO files
Changed paths:
A engines/petka/po-merge.pl
diff --git a/engines/petka/po-merge.pl b/engines/petka/po-merge.pl
new file mode 100644
index 000000000..fdb522700
--- /dev/null
+++ b/engines/petka/po-merge.pl
@@ -0,0 +1,201 @@
+#!perl
+
+# Parse .po files for Red Comrades
+
+use utf8;
+
+use open qw/:std :utf8/;
+
+if ($#ARGV < 0) {
+ die "Usage: $0 <file.po>...";
+}
+
+my $idx1 = "";
+my $idx2 = "";
+my $seenheader = 0;
+
+my $inmsgid = 0;
+my $inmsgstr = 0;
+our %data;
+our %data1;
+our %data3;
+
+my $prevvalue;
+
+my @poOrder;
+
+
+foreach my $file (@ARGV) {
+ unless (-e $file) {
+ next;
+ }
+
+ print STDERR "Processing $file...";
+
+ open IN , '<'.$file or die $!;
+ while (<IN>) {
+ chomp;
+
+ if (/^#\. (.*)$/) {
+ $idx1 = $1;
+
+ $seenheader = 1;
+
+ $inmsgid = $inmsgstr = 0;
+
+ $prevvalue = $data{$idx1};
+
+ push @poOrder, $idx1;
+
+ next;
+ }
+
+ if (/^msgid ""$/) {
+ $inmsgid = 1;
+ next;
+ }
+
+ if (/^msgstr ""$/) {
+ $inmsgid = 0;
+ $inmsgstr = 1;
+
+ if (length $prevvalue) {
+ if ($prevvalue ne $data{$idx1}) {
+ warn "Not matching $file:$idx1\n";
+ }
+ }
+ next;
+ }
+
+ if (/^msgid (.*)$/) {
+ my $s = $1;
+
+ $s =~ s/^"\s*|\s*"$//g;
+
+ $data{$idx1} = $s;
+
+ $inmsgid = 0;
+ }
+
+ if (/^msgstr (.*)$/) {
+ my $s = $1;
+
+ $s =~ s/(^")|("$)//g;
+
+ $data1{$idx1} = $s;
+
+ $inmsgstr = 0;
+
+ if (length $prevvalue) {
+ if ($prevvalue ne $data{$idx1}) {
+ warn "Not matching $file:$idx1 ($prevvalue) <=> ($data{$idx1})\n";
+ }
+ }
+ }
+
+ if (/^"(.*)"$/) {
+ if ($inmsgid) {
+ $data{$idx1} .= $1;
+ } elsif ($inmsgstr) {
+ $data{$idx1} =~ s/^\s+|\s+$//g;
+ $data1{$idx1} .= $1;
+ }
+ }
+ }
+ close IN;
+
+ print STDERR "done\n";
+}
+
+# Read strings
+
+foreach my $file ("strings.bytes", "stringsEN.bytes") {
+ print STDERR "Processing $file...";
+
+ open IN , '<'.$file or die $!;
+ while (<IN>) {
+ chomp;
+
+ next if /^\/\//;
+ next unless length;
+
+ /^([^ ]+) (.*)$/;
+
+ $data3{$file}{$1} = $2;
+ }
+ close IN;
+
+ print STDERR "done\n";
+}
+
+# Check for differently translated strings
+my %dict;
+for $k (keys %{ $data3{"strings.bytes"} }) {
+ my $w = $data3{"strings.bytes"}{$k};
+ my $t = $data3{"stringsEN.bytes"}{$k};
+
+ next if ($t =~ /[Ð-Яа-Ñ]/);
+ $w =~ s/"/\\"/g;
+ $t =~ s/"/\\"/g;
+ $w =~ s/^\s+|\s+$//g;
+ $t =~ s/^\s+|\s+$//g;
+
+ if (exists $dict{$w}) {
+ if ($dict{$w} ne $t) {
+ warn "Double translated $k: ($dict{$w}) vs ($t)\n";
+ }
+ next;
+ }
+
+ $dict{$w} = $t;
+}
+
+# Now print out .pot file
+
+print <<EOF;
+# LANGUAGE translation for Petka1.
+# Copyright (C) 2020 ScummVM Team
+# This file is distributed under the same license as the ScummVM package.
+# Eugene Sandulenko <sev\@scummvm.org>, 2020.
+
+msgid ""
+msgstr ""
+"Project-Id-Version: Petka1 0.0.1\\n"
+"Report-Msgid-Bugs-To: scummvm-devel\@lists.scummvm.org\\n"
+"POT-Creation-Date: 2020-12-07 22:01+0000\\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"
+"Last-Translator: FULL NAME <EMAIL\@ADDRESS>\\n"
+"Language-Team: LANGUAGE <LL\@li.org>\\n"
+"Language: \\n"
+"MIME-Version: 1.0\\n"
+"Content-Type: text/plain; charset=utf-8\\n"
+"Content-Transfer-Encoding: 8bit\\n"
+
+EOF
+
+my $missings;
+my $matches;
+for my $k (@poOrder) {
+ print "#. $k\n";
+ print "msgid \"$data{$k}\"\n";
+
+ if ($data{$k} =~ /^I(.*)/) {
+ if (exists $dict{$1}) {
+ print "msgstr \"I$dict{$1}\"\n\n";
+ $matches++;
+ next;
+ }
+ }
+
+ if (exists $dict{$data{$k}}) {
+ print "msgstr \"$dict{$data{$k}}\"\n";
+ $matches++;
+ } else {
+ print "msgstr \"\"\n";
+ $missings++;
+ }
+
+ print "\n";
+}
+
+warn "$matches matches, $missings missings\n";
Commit: 8c9fd4a448645372889c9fa4bec52ac879c8cfaa
https://github.com/scummvm/scummvm-tools/commit/8c9fd4a448645372889c9fa4bec52ac879c8cfaa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-12-12T13:44:47+01:00
Commit Message:
PETKA: Added potmode to po-merge tool
Changed paths:
engines/petka/po-merge.pl
diff --git a/engines/petka/po-merge.pl b/engines/petka/po-merge.pl
index fdb522700..bc0a1aebf 100644
--- a/engines/petka/po-merge.pl
+++ b/engines/petka/po-merge.pl
@@ -7,7 +7,7 @@ use utf8;
use open qw/:std :utf8/;
if ($#ARGV < 0) {
- die "Usage: $0 <file.po>...";
+ die "Usage: $0 [-pot] <file.po>...";
}
my $idx1 = "";
@@ -24,8 +24,14 @@ my $prevvalue;
my @poOrder;
+my $potmode = 0;
foreach my $file (@ARGV) {
+ if ($file eq '-pot') {
+ $potmode = 1;
+ next;
+ }
+
unless (-e $file) {
next;
}
@@ -187,7 +193,7 @@ for my $k (@poOrder) {
}
}
- if (exists $dict{$data{$k}}) {
+ if (exists $dict{$data{$k}} && !$potmode) {
print "msgstr \"$dict{$data{$k}}\"\n";
$matches++;
} else {
More information about the Scummvm-git-logs
mailing list