4 chdir(dirname(__FILE__) . '/..');
6 /* Languages to pull */
8 'da_DK' => 'http://laconi.ca/translate/download.php?file_id=23',
9 'nl_NL' => 'http://laconi.ca/translate/download.php?file_id=39',
10 'en_NZ' => 'http://laconi.ca/translate/download.php?file_id=15',
11 'eo' => 'http://laconi.ca/translate/download.php?file_id=10',
12 'fr_FR' => 'http://laconi.ca/translate/download.php?file_id=19',
13 'de_DE' => 'http://laconi.ca/translate/download.php?file_id=18',
14 'it_IT' => 'http://laconi.ca/translate/download.php?file_id=21',
15 'ko' => 'http://laconi.ca/translate/download.php?file_id=33',
16 'no_NB' => 'http://laconi.ca/translate/download.php?file_id=31',
17 'pt' => 'http://laconi.ca/translate/download.php?file_id=8',
18 'pt_BR' => 'http://laconi.ca/translate/download.php?file_id=11',
19 'ru_RU' => 'http://laconi.ca/translate/download.php?file_id=26',
20 'es' => 'http://laconi.ca/translate/download.php?file_id=9',
21 'tr_TR' => 'http://laconi.ca/translate/download.php?file_id=37',
22 'uk_UA' => 'http://laconi.ca/translate/download.php?file_id=44',
23 'he_IL' => 'http://laconi.ca/translate/download.php?file_id=71',
26 /* Update the languages */
27 foreach ($languages as $code => $file) {
29 $lcdir='locale/'.$code;
30 $msgdir=$lcdir.'/LC_MESSAGES';
31 $pofile=$msgdir.'/laconica.po';
32 $mofile=$msgdir.'/laconica.mo';
34 /* Check for an existing */
35 if (!is_dir($msgdir)) {
40 $existingSHA1 = file_exists($pofile) ? sha1_file($pofile) : '';
43 /* Get the remote one */
44 $newFile = file_get_contents($file);
46 // Update if the local .po file is different to the one downloaded, or
47 // if the .mo file is not present.
48 if(sha1($newFile)!=$existingSHA1 || !file_exists($mofile)) {
49 echo "Updating ".$code."\n";
50 file_put_contents($pofile, $newFile);
53 system('msgmerge -U laconica.po ../../laconica.pot');
54 system('msgfmt -f -o laconica.mo laconica.po');
57 echo "Unchanged - ".$code."\n";