summaryrefslogtreecommitdiffstats
path: root/l10n/l10n.pl
diff options
context:
space:
mode:
authorJakob Sack <kde@jakobsack.de>2011-06-20 22:22:17 +0200
committerJakob Sack <kde@jakobsack.de>2011-06-20 22:22:17 +0200
commitf72db005b565505b7754915de9b10f636669f9cf (patch)
tree622ea1f0250633c0f50c40f3e904391406beecda /l10n/l10n.pl
parent3e74cca7398e21f6c46b9815e9fc0d46a5462cdb (diff)
downloadnextcloud-server-f72db005b565505b7754915de9b10f636669f9cf.tar.gz
nextcloud-server-f72db005b565505b7754915de9b10f636669f9cf.zip
Keep order when creating php files
Diffstat (limited to 'l10n/l10n.pl')
-rw-r--r--l10n/l10n.pl18
1 files changed, 9 insertions, 9 deletions
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