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