From 794c01074b09e1eb262f109fe6572f93d6d8ef5d Mon Sep 17 00:00:00 2001 From: Christian Walde Date: Wed, 24 Jul 2019 16:20:16 +0200 Subject: [PATCH] enforce presence of same number of color tags in source and translation --- kc.po | 15 ++++++++++++--- translate_utf8_binary.pl | 6 ++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/kc.po b/kc.po index 61f3ff9..809ae6b 100644 --- a/kc.po +++ b/kc.po @@ -5673,7 +5673,16 @@ msgid "" "\n" "さらに艦隊が居る場合は、それぞれに\n" "[115511]支援艦隊[-]を向かわせることが可能です。\n" -msgstr "Counterattack the enemy with the allied fleet. The battle is divided into two parts, Vanguard Fleet and Battle Fleet. In addition, it is possible to direct support to each part\n" +msgstr "" +"[000000]Counterattack the enemy with a [0055aa]combined fleet[-].\n" +"A [0055aa]combined fleet[-] is divided into two parts,\n" +"\n" +"・Vanguard Fleet\n" +"・Battle Fleet\n" +"\n" +"If there are more fleets, it is possible\n" +"to send each as a [115511]support fleet[-].\n" +"\n" msgctxt "resources_00945.-10|-1" msgid "" @@ -5747,7 +5756,7 @@ msgid "" "配備を解除した場合も、同じく回航状態となり\n" "ます。" msgstr "" -"[000000][000000]The more Regions away from your base,\n" +"[000000]The more Regions away from your base,\n" "the more days (turns) required for the [0055aa]voyage[-].\n" "If you cancel a Transportation or Escort Fleet,\n" "it will also be in a round trip." @@ -47558,7 +47567,7 @@ msgstr "" msgctxt "███ generic translation ███" msgid "残り継戦時間[F9C66CFF]100[-]日" -msgstr "100 days of war remain." +msgstr "[F9C66CFF]100[-] days of war remain." msgctxt "level4_00047.-15|-1" msgid "残り継戦時間[F9C66CFF]100[-]日" diff --git a/translate_utf8_binary.pl b/translate_utf8_binary.pl index 595775a..5634787 100644 --- a/translate_utf8_binary.pl +++ b/translate_utf8_binary.pl @@ -20,6 +20,7 @@ use countdown; use Locale::PO; use Devel::Confess; +use Test::More; =head1 DESCRIPTION @@ -781,6 +782,7 @@ sub run { $|++; binmode STDOUT, ":encoding(UTF-8)"; binmode STDERR, ":encoding(UTF-8)"; + Test::More->builder->output("/dev/null"); # allows using is_deeply without spam my ( $opt, $usage ) = describe_options( 'perl %c %o', @@ -828,6 +830,9 @@ sub run { $tr =~ s/\n/\\n/g; $tr =~ s/\\r//g; $po->msgstr($tr); + next if !$tr; + my ( $codes_src, $codes_tra ) = map [ map lc, sort ( $_ =~ /\[(-|b|\/b|[0-9a-fA-F]{6,8})\]/g ) ], $id, $tr; + die "color code mismatch" if not is_deeply $codes_tra, $codes_src, encode "UTF-8", "$id\n$tr\n@$codes_src\n@$codes_tra\n"; } cache_and_load_carriage_returns @pof[ 1 .. $#pof ]; @@ -1055,6 +1060,7 @@ sub run { io("report.txt")->utf8->print( join "\n", filter_nl @report ); say "\ndone"; + done_testing; return; }