Unverified Commit 1f4669e3 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

move translation reference to share/locales

parent 3d106ec4
Loading
Loading
Loading
Loading
+35 −10
Original line number Diff line number Diff line
@@ -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,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);
	}
+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
@@ -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*