Created
October 16, 2012 19:03
-
-
Save mschmitt/3901269 to your computer and use it in GitHub Desktop.
Friendica Helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The helpers I used for translating Friendica: | |
Makefile in views/eo-test: | |
all: | |
/opt/apache-php/bin/php ../../util/po2php.php ../eo-test/messages.po | |
copy: | |
cp *.tpl ../eo/ | |
cp *.po ../eo/ | |
cp *.php ../eo/ | |
/opt/apache-php/bin/php ../../util/po2php.php ../eo/messages.po | |
Perl script transifex_friendica for pulling the translated files from Transifex: | |
#!/usr/bin/perl -w | |
use strict; | |
use diagnostics; | |
use LWP::Simple; | |
use JSON; | |
my $proj = 'friendica'; | |
my $lang = 'eo'; | |
my $auth = 'mylogin:mypassword'; | |
my $fmt_list = 'https://%[email protected]/api/2/project/%s/resources/'; | |
my $fmt_trans = 'https://%[email protected]/api/2/project/%s/resource/%s/translation/%s/'; | |
my $url_resources = sprintf($fmt_list, $auth, $proj); | |
my $resources = decode_json(get($url_resources)); | |
foreach(@{$resources}){ | |
my $res = $_; | |
my $slug = $res->{'slug'}; | |
my $name = $res->{'name'}; | |
my $url_trans = sprintf($fmt_trans, $auth, $proj, $slug, $lang); | |
my $resource = decode_json(get($url_trans)); | |
my $content = $resource->{'content'}; | |
open my $fh_out, ">/tmp/$name"; | |
binmode $fh_out, ':utf8'; | |
print $fh_out $content; | |
close $fh_out; | |
print "/tmp/$name\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment