summaryrefslogtreecommitdiff
path: root/scripts/update_translations.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2009-11-03 12:13:24 -0800
committerBrion Vibber <brion@pobox.com>2009-11-03 12:13:24 -0800
commit06a5090bfcbc95f0ee65d138ac35c0b0dda51668 (patch)
tree34ee7bebd79159802fa87596a4d527acc4e6c255 /scripts/update_translations.php
parentd03a57853e06310228f7df782dd60068863f4a69 (diff)
Update translations from TranslateWiki
scripts/update_translations.php now pulls updated files from TranslateWiki and merges them to an updated master. Note that the .po files exported from TranslateWiki do lose some of the old manual comments for now.
Diffstat (limited to 'scripts/update_translations.php')
-rwxr-xr-xscripts/update_translations.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/update_translations.php b/scripts/update_translations.php
index f145c1f0b..4f3ebb1a2 100755
--- a/scripts/update_translations.php
+++ b/scripts/update_translations.php
@@ -43,8 +43,16 @@ $languages = get_all_languages();
foreach ($languages as $language) {
$code = $language['lang'];
- $file_url = 'http://status.net/pootle/' . $code .
- '/statusnet/LC_MESSAGES/statusnet.po';
+
+ // Fetch updates from TranslateWiki...
+ $twcode = str_replace('_', '-', strtolower($code)); // pt_BR -> pt-br
+ $file_url = 'http://translatewiki.net/w/i.php?' .
+ http_build_query(array(
+ 'title' => 'Special:Translate',
+ 'task' => 'export-to-file',
+ 'group' => 'out-statusnet',
+ 'language' => $twcode));
+
$lcdir = INSTALLDIR . '/locale/' . $code;
$msgdir = "$lcdir/LC_MESSAGES";
$pofile = "$msgdir/statusnet.po";
@@ -72,7 +80,8 @@ foreach ($languages as $language) {
if (sha1($new_file) != $existingSHA1 || !file_exists($mofile)) {
echo "Updating ".$code."\n";
file_put_contents($pofile, $new_file);
- system(sprintf('msgmerge -U %s %s', $pofile, $statusnet_pot));
+ // --backup=off is workaround for Mac OS X fail
+ system(sprintf('msgmerge -U --backup=off %s %s', $pofile, $statusnet_pot));
system(sprintf('msgfmt -f -o %s %s', $mofile, $pofile));
} else {
echo "Unchanged - ".$code."\n";