]> granicus.if.org Git - php/commitdiff
name resource build script resourcebundle.build
authorStanislav Malyshev <stas@php.net>
Mon, 11 Jan 2010 23:46:43 +0000 (23:46 +0000)
committerStanislav Malyshev <stas@php.net>
Mon, 11 Jan 2010 23:46:43 +0000 (23:46 +0000)
ext/intl/tests/resourcebundle.build [new file with mode: 0644]

diff --git a/ext/intl/tests/resourcebundle.build b/ext/intl/tests/resourcebundle.build
new file mode 100644 (file)
index 0000000..6a7eeae
--- /dev/null
@@ -0,0 +1,33 @@
+<?php\r
+// THIS SCRIPT WILL REBUILD ResourceBundle bundles from source files\r
+\r
+// DEFINE YOUR ICU TOOLS PATH HERE\r
+define("ICU_DIR", "C:/PROJECTS/ICU40/BIN/");\r
+\r
+$here = dirname(__FILE__);\r
+\r
+$dir = new GlobIterator("$here/_files/*.txt", FilesystemIterator::KEY_AS_FILENAME);\r
+\r
+foreach($dir as $file) {\r
+  passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle ".$file->getFileName());\r
+}\r
+\r
+$dir = new GlobIterator("$here/_files/resourcebundle/*.res", FilesystemIterator::KEY_AS_FILENAME);\r
+foreach($dir as $file) {\r
+  if($file->getFileName() == "res_index.res") continue;\r
+  $list[] = str_replace(".res", "", $file->getFileName());\r
+}\r
+\r
+$filelist = join(" {\"\"}\n", $list);\r
+$res_index = <<<END\r
+res_index:table(nofallback) {\r
+    InstalledLocales {\r
+$filelist {""}\r
+    }\r
+}\r
+END;\r
+file_put_contents("$here/_files/res_index.txt", $res_index);\r
+\r
+passthru( ICU_DIR."genrb -s $here/_files/ -d $here/_files/resourcebundle res_index.txt");\r
+\r
+// passthru(ICU_DIR."icupkg -tl -a $here/rb.txt -s $here/_files -d $here/_files new $here/_files/resourcebundle.dat");
\ No newline at end of file