resourcebundle.build 1.1 KB

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