X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Fupdate_translations.php;h=1fe513b13baa86f19549b7014ea2bdb8416231f9;hb=b26eccf33cf69c04a96d5d6d3eddc0ef68ffd4b1;hp=88b85dc12316acf90c1fb85cda61bbcbf68952e0;hpb=814b513aa5d86a38e7b6db220d36fca253bdabfe;p=quix0rs-gnu-social.git diff --git a/scripts/update_translations.php b/scripts/update_translations.php index 88b85dc123..1fe513b13b 100755 --- a/scripts/update_translations.php +++ b/scripts/update_translations.php @@ -31,7 +31,7 @@ define('LACONICA', true); // compatibility require_once(INSTALLDIR . '/lib/common.php'); // Master StatusNet .pot file location (created by update_pot.sh) -$statusnet_pot = INSTALLDIR . '/locale/statusnet.po'; +$statusnet_pot = INSTALLDIR . '/locale/statusnet.pot'; set_time_limit(60); @@ -47,15 +47,24 @@ $codeMap = array( 'zh_TW' => 'zh-hant' ); +$doneCodes = array(); + foreach ($languages as $language) { $code = $language['lang']; // Skip export of source language // and duplicates - if( $code == 'en' || $code = 'no' ) { + if( $code == 'en' || $code == 'no' ) { continue; } + // Do not export codes twice (happens for 'nb') + if( in_array( $code, $doneCodes ) ) { + continue; + } else { + $doneCodes[] = $code; + } + // Convert code if needed if( isset( $codeMap[$code] ) ) { $twnCode = $codeMap[$code]; @@ -68,8 +77,8 @@ foreach ($languages as $language) { http_build_query(array( 'title' => 'Special:Translate', 'task' => 'export-to-file', - 'group' => 'out-statusnet', - 'language' => $twcode)); + 'group' => 'out-statusnet-core', + 'language' => $twnCode)); $lcdir = INSTALLDIR . '/locale/' . $code; $msgdir = "$lcdir/LC_MESSAGES"; @@ -89,7 +98,7 @@ foreach ($languages as $language) { $new_file = curl_get_file($file_url); if ($new_file === FALSE) { - echo "Couldn't retrieve .po file for $code: $file_url\n"; + echo "Could not retrieve .po file for $code: $file_url\n"; continue; } @@ -100,7 +109,10 @@ foreach ($languages as $language) { file_put_contents($pofile, $new_file); // --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)); + /* Do not rebuild/add .mo files by default + * FIXME: should be made a command line parameter. + system(sprintf('msgfmt -o %s %s', $mofile, $pofile)); + */ } else { echo "Unchanged - ".$code."\n"; }