note 104050 added to class.resourcebundle
| From: | maiseralves at gmail dot com | Date: | Thu, 19 May 2011 20:03:46 +0000 |
| Subject: | note 104050 added to class.resourcebundle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179887@lists.php.net to get a copy of this message | ||
<?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"
*/
?>
----
Server IP: 187.16.23.134
Probable Submitter: 189.103.21.174
----
Manual Page -- http://www.php.net/manual/en/class.resourcebundle.php
Edit -- https://master.php.net/note/edit/104050
Del: integrated -- https://master.php.net/note/delete/104050/integrated
Del: useless -- https://master.php.net/note/delete/104050/useless
Del: bad code -- https://master.php.net/note/delete/104050/bad+code
Del: spam -- https://master.php.net/note/delete/104050/spam
Del: non-english -- https://master.php.net/note/delete/104050/non-english
Del: in docs -- https://master.php.net/note/delete/104050/in+docs
Del: other reasons-- https://master.php.net/note/delete/104050
Reject -- https://master.php.net/note/reject/104050
Search -- https://master.php.net/manage/user-notes.php