Recommend this page to a friend! |
Download .zip |
Info | View files (6) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2002-07-26 (14 years ago) | Not yet rated by the users | Total: 1,880 This week: 1 | All time: 2,034 This week: 1,047 |
Version | License | Categories | ||||
msgcat 1.0.0 | GNU General Publi... | Localization |
Description | Author | ||||||||||||||
Basic message Catalog utility for php, provides a basic way to generate multiple languages scripts |
|
===== 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 |
File | Role | Description |
---|---|---|
debug | Output | Demo debug file |
en.msg | Example | Demo msg file |
LICENSE | Doc. | GNU GPL License |
msgcat_class.php | Class | msgcat class |
readme.txt | Doc. | Documentation |
test.php3 | Example | Demo script |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
Applications that use this package |
Nasker International Snacks Pet-food SL Site based on this class and LANG_DETECT class, most pages are dinamically transtaled based on lang. settings |
If you know an application of this package, send a message to the author to add a link here.
Related pages |
Language Detect Class in PHPClasses A handy class that can provide a way to choose initial and appropiate languages based on the client's browser language settings |