blob: 4c1c7c38d73fc91a4423fbf644b27e820653196b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 );
}
|