Loading lib/Travelynx/Command/translation.pm +35 −10 Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ sub run { my @locales = (qw(de-DE en-GB fr-FR hu-HU pl-PL)); my %count; my %handle; for my $locale (@locales) { $handle{$locale} = Travelynx::Helper::Locales->get_handle($locale); $handle{$locale}->fail_with('failure_handler_auto'); $count{$locale} = 0; } binmode( STDOUT, ':encoding(utf-8)' ); Loading @@ -27,32 +29,55 @@ sub run { if ( not $command ) { $self->help; } elsif ( $command eq 'status' ) { say '# Translation Status'; say q{}; elsif ( $command eq 'update-ref' ) { my @buf; open( my $fh, '<:encoding(utf-8)', 'share/locales/de_DE.po' ); my $comment; for my $line (<$fh>) { chomp $line; if ( $line =~ m{ ^ [#] \s+ (.*) $ }x ) { say "## $1"; say q{}; push( @buf, "## $1\n" ); } elsif ( $line =~ m{ ^ [#] , \s+ (.*) $ }x ) { $comment = $1; } elsif ( $line =~ m{ ^ msgid \s+ " (.*) " $ }x ) { my $id = $1; say "### ${id}"; say q{}; push( @buf, "### ${id}\n" ); if ($comment) { push( @buf, '*' . $comment . "*\n" ); $comment = undef; } for my $locale (@locales) { my $translation = $handle{$locale}->maketext($id); if ( $translation ne $id ) { say "* ${locale}: ${translation}"; push( @buf, "* ${locale}: ${translation}" ); $count{$locale} += 1; } else { say "* ${locale} *missing*"; push( @buf, "* ${locale} *missing*" ); } } push( @buf, q{} ); } } say q{}; close($fh); open( $fh, '>:encoding(utf-8)', 'share/locales/reference.md' ); say $fh '# Translation Status'; say $fh q{}; for my $locale (@locales) { say $fh sprintf( '* %s: %.1f%% complete (%d missing)', $locale, $count{$locale} * 100 / $count{'de-DE'}, $count{'de-DE'} - $count{$locale}, ); } say $fh q{}; for my $line (@buf) { say $fh $line; } close($fh); } Loading translation-status.md→share/locales/reference.md +58 −0 Original line number Diff line number Diff line # Translation Status * de-DE: 100.0% complete (0 missing) * en-GB: 100.0% complete (0 missing) * fr-FR: 36.2% complete (102 missing) * hu-HU: 87.5% complete (20 missing) * pl-PL: 36.2% complete (102 missing) ### * de-DE: Language: de-DE Loading Loading @@ -504,6 +510,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.trip *short* * de-DE: Fahrt * en-GB: Trip * fr-FR *missing* Loading @@ -512,6 +520,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.from *short* * de-DE: Von * en-GB: From * fr-FR *missing* Loading @@ -520,6 +530,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.to *short* * de-DE: Nach * en-GB: To * fr-FR *missing* Loading @@ -528,6 +540,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.departure *short* * de-DE: Abfahrt * en-GB: Departure * fr-FR *missing* Loading @@ -536,6 +550,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.arrival *short* * de-DE: Ankunft * en-GB: Arrival * fr-FR *missing* Loading @@ -544,6 +560,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.distance *short* * de-DE: Strecke * en-GB: Distance * fr-FR *missing* Loading @@ -568,6 +586,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.speed *short* * de-DE: Tempo * en-GB: Speed * fr-FR *missing* Loading @@ -576,6 +596,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.operator *short* * de-DE: Betrieb * en-GB: Operator * fr-FR *missing* Loading @@ -584,6 +606,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.messages *short* * de-DE: Meldungen * en-GB: Messages * fr-FR *missing* Loading @@ -592,6 +616,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.comment *short* * de-DE: Kommentar * en-GB: Comment * fr-FR *missing* Loading @@ -600,6 +626,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.carriages *short* * de-DE: Rollmaterial * en-GB: Carriages * fr-FR *missing* Loading @@ -608,6 +636,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.route *short* * de-DE: Route * en-GB: Route * fr-FR *missing* Loading Loading @@ -690,6 +720,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### landingpage.departures *As short as possible* * de-DE: Abfahrten * en-GB: Departures * fr-FR *missing* Loading Loading @@ -1058,6 +1090,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.boarding-in.pre *noun or verb* * de-DE: Einfahrt in * en-GB: arrives in * fr-FR *missing* Loading @@ -1066,6 +1100,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.boarding-in.post *noun or verb* * de-DE: * en-GB: * fr-FR *missing* Loading @@ -1074,6 +1110,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.boarding-soon *noun or verb* * de-DE: fährt ein * en-GB: now arriving * fr-FR *missing* Loading @@ -1082,6 +1120,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.departure-in.pre *noun or verb* * de-DE: Abfahrt in * en-GB: departs in * fr-FR *missing* Loading @@ -1090,6 +1130,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.departure-in.post *noun or verb* * de-DE: * en-GB: * fr-FR *missing* Loading @@ -1098,6 +1140,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.departure-soon *noun or verb* * de-DE: fährt ab * en-GB: now departing * fr-FR *missing* Loading @@ -1106,6 +1150,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.arrival-in.pre *noun or verb* * de-DE: Ankunft in * en-GB: arrives in * fr-FR: Arrive dans Loading @@ -1114,6 +1160,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.arrival-in.post *noun or verb* * de-DE: * en-GB: * fr-FR: Loading @@ -1122,6 +1170,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.arrival-soon *noun or verb* * de-DE: Ankunft in weniger als einer Minute * en-GB: now arriving * fr-FR: Arrive dans moins d'une minute Loading Loading @@ -1194,6 +1244,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.messages *service messages related to the trip* * de-DE: Meldungen * en-GB: Notifications * fr-FR *missing* Loading Loading @@ -1234,6 +1286,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.undo *shown during destination selection* * de-DE: Rückgängig * en-GB: Undo * fr-FR *missing* Loading @@ -1242,6 +1296,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.privacy-level *shown during destination selection* * de-DE: Sichtbarkeit * en-GB: Privacy * fr-FR *missing* Loading @@ -1250,6 +1306,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.undo-checkin *shown once check-in is completed* * de-DE: Checkin rückgängig * en-GB: Undo check-in * fr-FR *missing* Loading Loading
lib/Travelynx/Command/translation.pm +35 −10 Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ sub run { my @locales = (qw(de-DE en-GB fr-FR hu-HU pl-PL)); my %count; my %handle; for my $locale (@locales) { $handle{$locale} = Travelynx::Helper::Locales->get_handle($locale); $handle{$locale}->fail_with('failure_handler_auto'); $count{$locale} = 0; } binmode( STDOUT, ':encoding(utf-8)' ); Loading @@ -27,32 +29,55 @@ sub run { if ( not $command ) { $self->help; } elsif ( $command eq 'status' ) { say '# Translation Status'; say q{}; elsif ( $command eq 'update-ref' ) { my @buf; open( my $fh, '<:encoding(utf-8)', 'share/locales/de_DE.po' ); my $comment; for my $line (<$fh>) { chomp $line; if ( $line =~ m{ ^ [#] \s+ (.*) $ }x ) { say "## $1"; say q{}; push( @buf, "## $1\n" ); } elsif ( $line =~ m{ ^ [#] , \s+ (.*) $ }x ) { $comment = $1; } elsif ( $line =~ m{ ^ msgid \s+ " (.*) " $ }x ) { my $id = $1; say "### ${id}"; say q{}; push( @buf, "### ${id}\n" ); if ($comment) { push( @buf, '*' . $comment . "*\n" ); $comment = undef; } for my $locale (@locales) { my $translation = $handle{$locale}->maketext($id); if ( $translation ne $id ) { say "* ${locale}: ${translation}"; push( @buf, "* ${locale}: ${translation}" ); $count{$locale} += 1; } else { say "* ${locale} *missing*"; push( @buf, "* ${locale} *missing*" ); } } push( @buf, q{} ); } } say q{}; close($fh); open( $fh, '>:encoding(utf-8)', 'share/locales/reference.md' ); say $fh '# Translation Status'; say $fh q{}; for my $locale (@locales) { say $fh sprintf( '* %s: %.1f%% complete (%d missing)', $locale, $count{$locale} * 100 / $count{'de-DE'}, $count{'de-DE'} - $count{$locale}, ); } say $fh q{}; for my $line (@buf) { say $fh $line; } close($fh); } Loading
translation-status.md→share/locales/reference.md +58 −0 Original line number Diff line number Diff line # Translation Status * de-DE: 100.0% complete (0 missing) * en-GB: 100.0% complete (0 missing) * fr-FR: 36.2% complete (102 missing) * hu-HU: 87.5% complete (20 missing) * pl-PL: 36.2% complete (102 missing) ### * de-DE: Language: de-DE Loading Loading @@ -504,6 +510,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.trip *short* * de-DE: Fahrt * en-GB: Trip * fr-FR *missing* Loading @@ -512,6 +520,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.from *short* * de-DE: Von * en-GB: From * fr-FR *missing* Loading @@ -520,6 +530,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.to *short* * de-DE: Nach * en-GB: To * fr-FR *missing* Loading @@ -528,6 +540,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.departure *short* * de-DE: Abfahrt * en-GB: Departure * fr-FR *missing* Loading @@ -536,6 +550,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.arrival *short* * de-DE: Ankunft * en-GB: Arrival * fr-FR *missing* Loading @@ -544,6 +560,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.distance *short* * de-DE: Strecke * en-GB: Distance * fr-FR *missing* Loading @@ -568,6 +586,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.speed *short* * de-DE: Tempo * en-GB: Speed * fr-FR *missing* Loading @@ -576,6 +596,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.operator *short* * de-DE: Betrieb * en-GB: Operator * fr-FR *missing* Loading @@ -584,6 +606,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.messages *short* * de-DE: Meldungen * en-GB: Messages * fr-FR *missing* Loading @@ -592,6 +616,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.comment *short* * de-DE: Kommentar * en-GB: Comment * fr-FR *missing* Loading @@ -600,6 +626,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.carriages *short* * de-DE: Rollmaterial * en-GB: Carriages * fr-FR *missing* Loading @@ -608,6 +636,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### journey.route *short* * de-DE: Route * en-GB: Route * fr-FR *missing* Loading Loading @@ -690,6 +720,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### landingpage.departures *As short as possible* * de-DE: Abfahrten * en-GB: Departures * fr-FR *missing* Loading Loading @@ -1058,6 +1090,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.boarding-in.pre *noun or verb* * de-DE: Einfahrt in * en-GB: arrives in * fr-FR *missing* Loading @@ -1066,6 +1100,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.boarding-in.post *noun or verb* * de-DE: * en-GB: * fr-FR *missing* Loading @@ -1074,6 +1110,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.boarding-soon *noun or verb* * de-DE: fährt ein * en-GB: now arriving * fr-FR *missing* Loading @@ -1082,6 +1120,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.departure-in.pre *noun or verb* * de-DE: Abfahrt in * en-GB: departs in * fr-FR *missing* Loading @@ -1090,6 +1130,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.departure-in.post *noun or verb* * de-DE: * en-GB: * fr-FR *missing* Loading @@ -1098,6 +1140,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.departure-soon *noun or verb* * de-DE: fährt ab * en-GB: now departing * fr-FR *missing* Loading @@ -1106,6 +1150,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.arrival-in.pre *noun or verb* * de-DE: Ankunft in * en-GB: arrives in * fr-FR: Arrive dans Loading @@ -1114,6 +1160,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.arrival-in.post *noun or verb* * de-DE: * en-GB: * fr-FR: Loading @@ -1122,6 +1170,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.arrival-soon *noun or verb* * de-DE: Ankunft in weniger als einer Minute * en-GB: now arriving * fr-FR: Arrive dans moins d'une minute Loading Loading @@ -1194,6 +1244,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.messages *service messages related to the trip* * de-DE: Meldungen * en-GB: Notifications * fr-FR *missing* Loading Loading @@ -1234,6 +1286,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.undo *shown during destination selection* * de-DE: Rückgängig * en-GB: Undo * fr-FR *missing* Loading @@ -1242,6 +1296,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.privacy-level *shown during destination selection* * de-DE: Sichtbarkeit * en-GB: Privacy * fr-FR *missing* Loading @@ -1250,6 +1306,8 @@ Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 && (n<10 || n>=20) ? 1 ### status.undo-checkin *shown once check-in is completed* * de-DE: Checkin rückgängig * en-GB: Undo check-in * fr-FR *missing* Loading