diff options
author | Jakob Sack <mail@jakobsack.de> | 2013-07-16 21:38:31 +0200 |
---|---|---|
committer | Jakob Sack <mail@jakobsack.de> | 2013-07-16 21:44:50 +0200 |
commit | 18fc22b52bdf1d8372a6e9c602872c423ce50eff (patch) | |
tree | e31f2bed9a2431f52155cb2ded5d566e968be6ff /l10n/l10n.pl | |
parent | 4e214883d64acf4dc9cc3191780086d0a9dac60f (diff) | |
download | nextcloud-server-18fc22b52bdf1d8372a6e9c602872c423ce50eff.tar.gz nextcloud-server-18fc22b52bdf1d8372a6e9c602872c423ce50eff.zip |
Allow several plural forms in l10n php files
Diffstat (limited to 'l10n/l10n.pl')
-rw-r--r-- | l10n/l10n.pl | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/l10n/l10n.pl b/l10n/l10n.pl index 8d13ec29a37..7694749dadf 100644 --- a/l10n/l10n.pl +++ b/l10n/l10n.pl @@ -102,10 +102,10 @@ if( $task eq 'read' ){ next if $ignore{$file}; my $keywords = ''; if( $file =~ /\.js$/ ){ - $keywords = '--keyword=t:2 --keyword=tp:2,3'; + $keywords = '--keyword=t:2 --keyword=n:2,3'; } else{ - $keywords = '--keyword=t --keyword=tp:1,2'; + $keywords = '--keyword=t --keyword=n:1,2'; } my $language = ( $file =~ /\.js$/ ? 'Python' : 'PHP'); my $joinexisting = ( -e $output ? '--join-existing' : ''); @@ -137,10 +137,15 @@ elsif( $task eq 'write' ){ # Do we use singular or plural? if( defined( $string->msgstr_n() )){ - next if $string->msgstr_n()->{"0"} eq '""' || - $string->msgstr_n()->{"1"} eq '""'; - push( @strings, $string->msgid()." => ".$string->msgstr_n()->{"0"} ); - push( @strings, $string->msgid_plural()." => ".$string->msgstr_n()->{"1"} ); + my @variants = (); + my $identifier = $string->msgid()."::".$string->msgid_plural() + $identifier =~ s/"/_/g; + + foreach my $variant ( sort { $a <=> $b} keys( %{$string->msgstr_n()} )){ + push( @variants, $string->msgstr_n()->{$variant} ); + } + + push( @strings, "\"$identifier\" => array(".join(@variants, ",").")"; } else{ next if $string->msgstr() eq '""'; |