diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-07-27 14:01:07 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-07-27 14:01:07 +0200 |
commit | 1f4669e3fc58c384e0d69f634a1a638cec600c97 (patch) | |
tree | 1245c711cf2387604a046f6c9ccffbe863952fb7 | |
parent | 3d106ec4d1f4ffe0e04158e2b47002932a43cac0 (diff) |
move translation reference to share/locales
-rw-r--r-- | lib/Travelynx/Command/translation.pm | 45 | ||||
-rw-r--r-- | share/locales/reference.md (renamed from translation-status.md) | 58 |
2 files changed, 93 insertions, 10 deletions
diff --git a/lib/Travelynx/Command/translation.pm b/lib/Travelynx/Command/translation.pm index 1f9ae78..70bdaba 100644 --- a/lib/Travelynx/Command/translation.pm +++ b/lib/Travelynx/Command/translation.pm @@ -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)' ); @@ -27,34 +29,57 @@ 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*" ); } } - say q{}; + push( @buf, 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); } else { $self->help; diff --git a/translation-status.md b/share/locales/reference.md index 070b486..a93c64a 100644 --- a/translation-status.md +++ b/share/locales/reference.md @@ -1,5 +1,11 @@ # 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 @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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* @@ -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 @@ -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: @@ -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 @@ -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* @@ -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* @@ -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* @@ -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* |