From 7438b9e6905ed2fed867357609f7627cd79d4c25 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Thu, 7 Jan 2021 18:30:32 +0100 Subject: [PATCH] =?utf8?q?locales-Skript:=20all/more=20ber=C3=BCcksichtige?= =?utf8?q?n,=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit indem Texte, die ausschließlich dort vorhanden sind, nicht in all eingetragen werden. Texte, die vorher schon in all sind, bleiben aber erhalten. Das sind dann (vermutlich) die Texte, die in more für ein Kundenprojekt eine andere Übersetzung haben sollen (und nicht neu hinzu kamen). --- scripts/locales.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/locales.pl b/scripts/locales.pl index c81f7b41c..7891fe9c4 100755 --- a/scripts/locales.pl +++ b/scripts/locales.pl @@ -144,12 +144,18 @@ for my $file_name (grep { /\.(?:js|html)$/i } map({find_files($_)} @javascript_d # merge entries to translate with entries from files 'missing' and 'lost' merge_texts(); -# generate all +# Generate "all" without translations in more_texts. +# But keep the ones which are in both old_texts (texts) and more_texts, +# because this are ones which are overwritten in more_texts for custom usage. +my %to_keep; +$to_keep{$_} = 1 for grep { !!$self->{more_texts}{$_} } keys %old_texts; +my @new_all = grep { $to_keep{$_} || !$self->{more_texts}{$_} } sort keys %alllocales; + generate_file( file => "$locales_dir/all", header => $ALL_HEADER, data_name => '$self->{texts}', - data_sub => sub { _print_line($_, $self->{texts}{$_}, @_) for sort keys %alllocales }, + data_sub => sub { _print_line($_, $self->{texts}{$_}, @_) for @new_all }, ); open(my $js_file, '>:encoding(utf8)', $javascript_output_dir .'/locale/'. $locale .'.js') || die; -- 2.20.1