diff options
Diffstat (limited to 'docs/createtranslation.pl')
-rw-r--r-- | docs/createtranslation.pl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/docs/createtranslation.pl b/docs/createtranslation.pl new file mode 100644 index 00000000000..4c1c7c38d73 --- /dev/null +++ b/docs/createtranslation.pl @@ -0,0 +1,28 @@ +#!/usr/bin/perl +use strict; +use Locale::PO; +use Data::Dumper; + +opendir( DIR, '.' ); +my @files = readdir( DIR ); +closedir( DIR ); + +foreach my $i ( @files ){ + next unless $i =~ m/^(.*)\.po$/; + my $lang = $1; + my $hash = Locale::PO->load_file_ashash( $i ); + + # Create array + my @strings = (); + foreach my $key ( keys( %{$hash} )){ + next if $key eq '""'; + push( @strings, $hash->{$key}->msgid()." => ".$hash->{$key}->msgstr()); + } + + # Write PHP file + open( OUT, ">$lang.php" ); + print OUT "<?php \$TRANSLATIONS = array(\n"; + print OUT join( ",\n", @strings ); + print OUT "\n);\n"; + close( OUT ); +}
\ No newline at end of file |