summaryrefslogtreecommitdiffstats
path: root/l10n
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-10-24 13:53:01 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-10-29 10:09:12 +0100
commit2f19de11e4c77b0f9195c3868960d8105541359f (patch)
treece8e3e45d519c392a7582e2fe452402e070301c0 /l10n
parentd71cd680dd6133ad254fd296319aeab6deb77686 (diff)
downloadnextcloud-server-2f19de11e4c77b0f9195c3868960d8105541359f.tar.gz
nextcloud-server-2f19de11e4c77b0f9195c3868960d8105541359f.zip
adding console command to generate javascript translation files based on existing php translation files
read server side translations from json files
Diffstat (limited to 'l10n')
-rw-r--r--l10n/l10n.pl19
1 files changed, 12 insertions, 7 deletions
diff --git a/l10n/l10n.pl b/l10n/l10n.pl
index 8b12f1abaed..7443a5f941d 100644
--- a/l10n/l10n.pl
+++ b/l10n/l10n.pl
@@ -120,7 +120,7 @@ if( $task eq 'read' ){
my $language = ( $file =~ /\.js$/ ? 'Python' : 'PHP');
my $joinexisting = ( -e $output ? '--join-existing' : '');
print " Reading $file\n";
- `xgettext --output="$output" $joinexisting $keywords --language=$language "$file" --add-comments=TRANSLATORS --from-code=UTF-8 --package-version="6.0.0" --package-name="ownCloud Core" --msgid-bugs-address="translations\@owncloud.org"`;
+ `xgettext --output="$output" $joinexisting $keywords --language=$language "$file" --add-comments=TRANSLATORS --from-code=UTF-8 --package-version="8.0.0" --package-name="ownCloud Core" --msgid-bugs-address="translations\@owncloud.org"`;
}
chdir( $whereami );
}
@@ -176,19 +176,24 @@ elsif( $task eq 'write' ){
s/\$/\\\$/g;
}
- # Write PHP file
- open( OUT, ">$language.php" );
- print OUT "<?php\n\$TRANSLATIONS = array(\n";
- print OUT join( ",\n", @strings );
- print OUT "\n);\n\$PLURAL_FORMS = \"$plurals\";\n";
- close( OUT );
+ # delete old php file
+ unlink "$language.php";
+ # Write js file
open( OUT, ">$language.js" );
print OUT "OC.L10N.register(\n \"$app\",\n {\n ";
print OUT join( ",\n ", @js_strings );
print OUT "\n},\n\"$plurals\");\n";
close( OUT );
+ # Write json file
+ open( OUT, ">$language.json" );
+ print OUT "{ \"translations\": ";
+ print OUT "{\n ";
+ print OUT join( ",\n ", @js_strings );
+ print OUT "\n},\"pluralForm\" :\"$plurals\"\n}";
+ close( OUT );
+
}
chdir( $whereami );
}