PHP Classes

msgcat: Message Catalog System

Recommend this page to a friend!
  Info   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 1,889 This week: 1All time: 2,088 This week: 571Up
Version License Categories
msgcat 1.0.0GNU General Publi...Localization
Description 

Author

Basic message Catalog utility for php, provides a basic way to generate multiple languages scripts

Picture of Carlos Falo Hervás
Name: Carlos Falo Hervás <contact>
Classes: 10 packages by
Country: Spain Spain
Age: 49
All time rank: 361 in Spain Spain
Week rank: 420 Down10 in Spain Spain Down
Innovation award
Innovation award
Nominee: 1x

Details

===== BASIC DOCUMENTATION FOR MSGCAT Multi Language class v 1.0 ===== 0.- INTRODUCTION This class is designed as a message catalog (just like in TCL or other scripting tools). Builds an array of translations for string identifiers and can be quite useful to deploy multiple language versions of the same scripts. NOTE IT STORES FULL MSG CATALOG ON MEMORY, DO NOT USE ON HEAVY TRANSLATION ENVIRONMENT 1.- INTERFACE The public interface for the class is formed by: msgcat($localstr,$loaddir="./",$debug=0) CONSTRUCTOR: Initializes catalog $localstr -> locale string identifier, used to determine translation file and msg validation $loaddir -> full path from current path to find *.msg files for the class $debug -> Debug level: 0-none; 1- <!-- --> echo; 2 - file 'debug' in $loaddir mc($srcstr) TRANSLATOR: Returns (string) translation for $srcstr for current locale $srcstr -> identifier to translate destroy() DESTRUCTOR; Close file operations and such 2.- MSG CATALOG FILES Each locale must have a file named [locale].msg to be used i.e. ENGLISH msg cataloc should be en.msg File contents will be as follows: [locale]#:#[identifier]#:#[translation]\n i.e. en#:#WM#:#Greetings, wellcome to my site en#:#CM#:#Come back soon! Comments can be added to the file on a line starting with '//' i.e. // General Messages en#:#MSG1#:#Test message 1 //Section names en#:#SECT1#:#File Archives en#:#SECT2#:#New entries 3.- CODING EXAMPLE <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <?php require("msgcat_class.php") ; ?> <html> <head> <title>MSGCAT test</title> </head> <body> <?php $msg = new msgcat("en") ; echo $msg->mc("WM") ; $msg->destroy() ; ?> </body> </html> This will output (based on the en.msg file from section 2 ex. 1) Greetings, wellcome to my site 4.- Future releases and WIP This class will not have many revisions as it is fully functional for it's intended use. For furtehr developement any suggestions are wellcome 3.- Contact information Carlos Falo Hervás carles@bisinteractive.net http://www.bisinteractive.net C/Manila 54-56 Esc. A Ent. 4ª 08034 Barcelona Spain Phone: +34 9 3 2063652 Fax: +34 9 3 2063689

  Files folder image Files  
File Role Description
Accessible without login Plain text file debug Output Demo debug file
Accessible without login Plain text file en.msg Example Demo msg file
Accessible without login Plain text file LICENSE Doc. GNU GPL License
Plain text file msgcat_class.php Class msgcat class
Accessible without login Plain text file readme.txt Doc. Documentation
Accessible without login Plain text file test.php3 Example Demo script

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,889
This week:1
All time:2,088
This week:571Up