Welcome to mirror list, hosted at ThFree Co, Russian Federation.

createtranslation.pl « docs - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 12ba22a5ea44109e9eb9d6c10d22e0100353b2ab (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
29
#!/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 '""';
		next if $hash->{$key}->msgstr() 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 );
}