]> source.dussan.org Git - nextcloud-server.git/commitdiff
Ignore empty plurals just like with singulars
authorJoas Schilling <nickvergessen@gmx.de>
Fri, 20 Feb 2015 10:36:56 +0000 (11:36 +0100)
committerJoas Schilling <nickvergessen@gmx.de>
Fri, 20 Feb 2015 10:36:56 +0000 (11:36 +0100)
The js and php code of n() has fallbacks for when the key is missing.
However there is no fallback, when the key is defined with an array of empty
strings. So we just don't extract them anymore and use the english language.

l10n/l10n.pl

index 26ed4ecba30a932082014d1280e5e6eea9152668..b4ad1d034dd27dbcede78f2bb23d01adaac28d10 100644 (file)
@@ -145,7 +145,7 @@ elsif( $task eq 'write' ){
                        my @js_strings = ();
                        my $plurals;
 
-                       foreach my $string ( @{$array} ){
+                       TRANSLATIONS: foreach my $string ( @{$array} ){
                                if( $string->msgid() eq '""' ){
                                        # Translator information
                                        $plurals = getPluralInfo( $string->msgstr());
@@ -157,6 +157,7 @@ elsif( $task eq 'write' ){
                                        $identifier =~ s/"/_/g;
 
                                        foreach my $variant ( sort { $a <=> $b} keys( %{$string->msgstr_n()} )){
+                                               next TRANSLATIONS if $string->msgstr_n()->{$variant} eq '""';
                                                push( @variants, $string->msgstr_n()->{$variant} );
                                        }
 
@@ -165,7 +166,7 @@ elsif( $task eq 'write' ){
                                }
                                else{
                                        # singular translations
-                                       next if $string->msgstr() eq '""';
+                                       next TRANSLATIONS if $string->msgstr() eq '""';
                                        push( @strings, $string->msgid()." => ".$string->msgstr());
                                        push( @js_strings, $string->msgid()." : ".$string->msgstr());
                                }