xref: /PHP-5.4/ext/intl/tests/resourcebundle.build (revision 9762609c)
1<?php
2// THIS SCRIPT WILL REBUILD ResourceBundle bundles from source files
3
4// DEFINE YOUR ICU TOOLS PATH HERE
5define("ICU_DIR", "C:/PROJECTS/ICU40/BIN/");
6
7$here = dirname(__FILE__);
8
9$dir = new GlobIterator("$here/_files/*.txt", FilesystemIterator::KEY_AS_FILENAME);
10
11foreach($dir as $file) {
12  passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle ".$file->getFileName());
13}
14
15$dir = new GlobIterator("$here/_files/resourcebundle/*.res", FilesystemIterator::KEY_AS_FILENAME);
16foreach($dir as $file) {
17  if($file->getFileName() == "res_index.res") continue;
18  $list[] = str_replace(".res", "", $file->getFileName());
19}
20
21$filelist = join(" {\"\"}\n", $list);
22$res_index = <<<END
23res_index:table(nofallback) {
24    InstalledLocales {
25$filelist {""}
26    }
27}
28END;
29file_put_contents("$here/_files/res_index.txt", $res_index);
30
31passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle res_index.txt");
32
33// passthru(ICU_DIR."icupkg -tl -a $here/rb.txt -s $here/_files -d $here/_files new $here/_files/resourcebundle.dat");