<?php
/*
* Struct of a Resource Bundle file
* file root.txt
* root:table {
* usage:string { "Usage: genrb [Options] files" }
* version:int { 122 }
* errorcodes:array {
* :string { "Invalid argument" }
* :string { "File not found" }
* }
* }
* use: $genrb root.txt to generate resource bundle file (root.res)
*/
//recursive function to list a resource bundle file structure using a ResourceBundle Object ( ) reference
function t($rb) {
foreach($rb as $k => $v) {
if(is_object($v)) {
print_r($v);
var_dump($k);
t($v);
} else {
var_dump($k . " " . $v);
}
}
}
//open root.res from folder locale
$rb = new ResourceBundle('root', "./locale");
t($rb);//call the function
/* The output from root table is
* |- string(34) "usage Usage: genrb [Options] files"
* |- string(11) "version 122"
* |- ResourceBundle Object ( ) string(10) "errorcodes"
* |- string(18) "0 Invalid argument"
* |- string(16) "1 File not found"
*/
?>