00001 <?php
00011 $bindir = dirname(__FILE__);
00012
00013 $msgs_file = 'config/i18n/en/messages.php';
00014 if(!file_exists($msgs_file)) {
00015 echo "Error: Cannot find $msgs_file\n\n";
00016 echo "Before running this script, you should generate an English messages file\n";
00017 echo "using the pronto/bin/i18n_scan.php script.\n\n";
00018 echo "Run this script from the top-level app-directory or from the top-level\n";
00019 echo "directory of a module.\n\n";
00020 exit(1);
00021 }
00022
00023 $LANGS = array(
00024 'ar' => 'Arabic',
00025 'zh_cn' => 'Chinese Simplified',
00026 'zh_tw' => 'Chinese Traditional',
00027 'nl' => 'Dutch',
00028 'fr' => 'French',
00029 'de' => 'German',
00030 'el' => 'Greek',
00031 'it' => 'Italian',
00032 'ja' => 'Japanese',
00033 'ko' => 'Korean',
00034 'pt' => 'Portuguese',
00035 'ru' => 'Russian',
00036 'es' => 'Spanish'
00037 );
00038
00039 $orig = file_get_contents($msgs_file);
00040 chdir('config/i18n');
00041 foreach($LANGS as $code=>$name) {
00042 echo "Translating English to $name...\n";
00043 $new = str_replace('$LANGUAGE_CODE = \'en\';', '$LANGUAGE_CODE = \''.$code.'\';', $orig);
00044 $new = str_replace('$LANGUAGE_NAME = \'English\';', '$LANGUAGE_NAME = \''.$name.'\';', $new);
00045 @mkdir($code);
00046 file_put_contents("$code/messages.php", $new);
00047
00048 system("php $bindir/google_translate.php $code/messages.php");
00049 }
00050
00051
00052 ?>