Skip to content
Snippets Groups Projects
Commit f72db005 authored by Jakob Sack's avatar Jakob Sack
Browse files

Keep order when creating php files

parent 3e74cca7
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment