Jump to content

ResourceBundle Class and resource files


simplyi

Recommended Posts

Hi!

 

I need help understanding how to access resource files using ResourceBundle Class and what should be ResourceBundle file format.

 

I have an example of usage in the form of:

 

$r = ResourceBundle::create( 'en', $fileName);

 

but what is the correct format of Resource file?

 

Can it be a format of property file in the form of

key=value

key=value?

 

or can it be a .txt file of format?:

 

root:table {

  myName:string { "Here goes my name" }

}

 

 

Can someone share a very simple example of ready to use Resource file with a plain text in it?

 

Thank you!

Link to comment
Share on other sites

thorpe, thank you very much for your reply.

 

I am using PHP5.3.1 intl package. I learned that this package was moved to php.net from PEAR.

 

Here is a link to ResourceBundle class:

http://ca2.php.net/manual/en/class.resourcebundle.php

 

And here is a link to example of usage:

http://ca2.php.net/manual/en/resourcebundle.get.php

 

thorpe, do you have experience using this class? can you advise how to create a Resouce file and the access it using ResourceBundle class?

 

Thank you!

 

 

Link to comment
Share on other sites

thorpe, thank you for moving back my question!

 

The intl package is working for me 50%. I have uncommented php_intl.dll in php.ini

 

extension=php_intl.dll

 

and I can work with Locale class no problem.

 

But when I execute

 

$r = ResourceBundle::create( 'en', $filename);

 

then I get an error message:  Fatal error: Class 'ResourceBundle' not found.

 

Both classes Locale and ResourceBundle are in one package "intl". Why is it that Locale class is found and ResourceBundle class cannot be found??? :(

 

Can someone advise me?

 

Thank you!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.