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=72',
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',
24 'mk_MK' => 'http://laconi.ca/translate/download.php?file_id=67',
25 'ja_JP' => 'http://laconi.ca/translate/download.php?file_id=43',
26 'cs_CZ' => 'http://laconi.ca/translate/download.php?file_id=63',
27 'ca_ES' => 'http://laconi.ca/translate/download.php?file_id=49',
28 'pl_PL' => 'http://laconi.ca/translate/download.php?file_id=51',
29 'sv_SE' => 'http://laconi.ca/translate/download.php?file_id=55'
32 /* Update the languages */
33 foreach ($languages as $code => $file) {
35 $lcdir='locale/'.$code;
36 $msgdir=$lcdir.'/LC_MESSAGES';
37 $pofile=$msgdir.'/laconica.po';
38 $mofile=$msgdir.'/laconica.mo';
40 /* Check for an existing */
41 if (!is_dir($msgdir)) {
46 $existingSHA1 = file_exists($pofile) ? sha1_file($pofile) : '';
49 /* Get the remote one */
50 $newFile = file_get_contents($file);
52 // Update if the local .po file is different to the one downloaded, or
53 // if the .mo file is not present.
54 if(sha1($newFile)!=$existingSHA1 || !file_exists($mofile)) {
55 echo "Updating ".$code."\n";
56 file_put_contents($pofile, $newFile);
59 system('msgmerge -U laconica.po ../../laconica.pot');
60 system('msgfmt -f -o laconica.mo laconica.po');
63 echo "Unchanged - ".$code."\n";