|
Revision 84, 1.4 kB
(checked in by rcrowley, 2 years ago)
|
Committing intl bits (though they won't work until after next intl round), fixed a few bugs (see B2), built and pushing JAR bits to Windows.
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
$locale = dirname(__FILE__) . '/MacUploadr.app/Contents/Resources/chrome/locale'; |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
if (!isset($argv[1])) { |
|---|
| 9 |
die("Usage: $argv[0] <intl-directory>\n"); |
|---|
| 10 |
} |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
foreach (array('de-de', 'es-us', 'fr-fr', 'it-it', 'ko-kr', 'pt-br', 'zh-hk') as $l) { |
|---|
| 14 |
$dir = opendir("$argv[1]/$l"); |
|---|
| 15 |
while (false !== $file = readdir($dir)) { |
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
if (0 == preg_match('/^.*ext_uploadr3_(.*\.(?:dtd|properties)).txt.php$/', $file, $match)) { |
|---|
| 19 |
continue; |
|---|
| 20 |
} |
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
if (!file_exists("$locale/$l") && !mkdir("$locale/$l", 0755)) { |
|---|
| 24 |
echo "[error] Can't create locale $l\n"; |
|---|
| 25 |
continue; |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
$text = file_get_contents("$argv[1]/$l/$file"); |
|---|
| 30 |
if (false === $text) { |
|---|
| 31 |
echo "[error] Reading $file\n"; |
|---|
| 32 |
continue; |
|---|
| 33 |
} |
|---|
| 34 |
$text = trim(str_replace("\n\n", "\n", preg_replace('/^<\?php.*\?>$/ms', '', $text))); |
|---|
| 35 |
$file = next($match); |
|---|
| 36 |
$file_p = fopen("$locale/$l/$file", 'w'); |
|---|
| 37 |
if (false === $file_p) { |
|---|
| 38 |
echo "[error] Opening $file\n"; |
|---|
| 39 |
continue; |
|---|
| 40 |
} |
|---|
| 41 |
if (false === fwrite($file_p, $text)) { |
|---|
| 42 |
echo "[error] Writing $file\n"; |
|---|
| 43 |
} |
|---|
| 44 |
if (false === fclose($file_p)) { |
|---|
| 45 |
echo "[error] Closing $file\n"; |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
} |
|---|
| 49 |
closedir($dir); |
|---|
| 50 |
} |
|---|
| 51 |
|
|---|
| 52 |
?> |
|---|