From: Jakob Sack Date: Mon, 20 Jun 2011 20:22:17 +0000 (+0200) Subject: Keep order when creating php files X-Git-Tag: v3.0~267^2~480 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f72db005b565505b7754915de9b10f636669f9cf;p=nextcloud-server.git Keep order when creating php files --- diff --git a/l10n/l10n.pl b/l10n/l10n.pl index a5fab01a2fd..88abc821e95 100644 --- a/l10n/l10n.pl +++ b/l10n/l10n.pl @@ -30,6 +30,10 @@ my $place = '..'; die( "Usuage: l10n.pl task\ntask: read, write\n") unless $task && $place; +# Our current position +my $whereami = cwd(); +die( "Program must be executed in a l10n-folder called 'l10n'" ) unless $whereami =~ m/\/l10n$/; + # Where are i18n-files? my @dirs = crawl( $place ); @@ -44,9 +48,6 @@ foreach my $i ( @files ){ push( @languages, $i ) if -d $i && substr( $i, 0, 1 ) ne '.'; } -# Our current position -my $whereami = cwd(); - if( $task eq 'read' ){ foreach my $dir ( @dirs ){ my @temp = split( /\//, $dir ); @@ -79,14 +80,13 @@ elsif( $task eq 'write' ){ my $input = "${whereami}/$language/$app.po"; next unless -e $input; - my $hash = Locale::PO->load_file_ashash( $input ); - + my $array = Locale::PO->load_file_asarray( $input ); # Create array my @strings = (); - foreach my $key ( keys( %{$hash} )){ - next if $key eq '""'; - next if $hash->{$key}->msgstr() eq '""'; - push( @strings, $hash->{$key}->msgid()." => ".$hash->{$key}->msgstr()); + foreach my $string ( @{$array} ){ + next if $string->msgid() eq '""'; + next if $string->msgstr() eq '""'; + push( @strings, $string->msgid()." => ".$string->msgstr()); } next if $#strings == -1; # Skip empty files