4 chdir(dirname(__FILE__) . '/..');
6 /* Languages to pull */
8 'da_DK' => 'http://laconi.ca/translate/download.php?file_id=93',
9 'nl_NL' => 'http://laconi.ca/translate/download.php?file_id=97',
10 'en_NZ' => 'http://laconi.ca/translate/download.php?file_id=87',
11 'eo' => 'http://laconi.ca/translate/download.php?file_id=88',
12 'fr_FR' => 'http://laconi.ca/translate/download.php?file_id=99',
13 'de_DE' => 'http://laconi.ca/translate/download.php?file_id=100',
14 'it_IT' => 'http://laconi.ca/translate/download.php?file_id=101',
15 'ko' => 'http://laconi.ca/translate/download.php?file_id=102',
16 'no_NB' => 'http://laconi.ca/translate/download.php?file_id=104',
17 'pt' => 'http://laconi.ca/translate/download.php?file_id=106',
18 'pt_BR' => 'http://laconi.ca/translate/download.php?file_id=107',
19 'ru_RU' => 'http://laconi.ca/translate/download.php?file_id=109',
20 'es' => 'http://laconi.ca/translate/download.php?file_id=110',
21 'tr_TR' => 'http://laconi.ca/translate/download.php?file_id=114',
22 'uk_UA' => 'http://laconi.ca/translate/download.php?file_id=115',
23 'he_IL' => 'http://laconi.ca/translate/download.php?file_id=116',
24 'mk_MK' => 'http://laconi.ca/translate/download.php?file_id=103',
25 'ja_JP' => 'http://laconi.ca/translate/download.php?file_id=117',
26 'cs_CZ' => 'http://laconi.ca/translate/download.php?file_id=96',
27 'ca_ES' => 'http://laconi.ca/translate/download.php?file_id=95',
28 'pl_PL' => 'http://laconi.ca/translate/download.php?file_id=105',
29 'sv_SE' => 'http://laconi.ca/translate/download.php?file_id=128'
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";