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
https://forums.phpfreaks.com/topic/212111-resourcebundle-class-and-resource-files/
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!

 

 

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.