resourcebundle.build 1.1 KB

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