SimpleDataObjects container for Translation2
| From: | Alan Knowles | Date: | Thu, 15 Apr 2004 06:36:07 +0000 |
| Subject: | SimpleDataObjects container for Translation2 | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-27673@lists.php.net to get a copy of this message | ||
I just wrote a simple dataobjects container for translation2
http://devel.akbkhome.com/svn/index.php/akpear/_scratchpad_/Admin_Container_dataobjectsimple.php
http://devel.akbkhome.com/svn/index.php/akpear/_scratchpad_/Container_dataobjectsimple.php
It's not designed for speed, but rather ease of installation..
- it only uses one table (only the table name is configurable.)
create table translations (
id int(11) auto_increment not null primary key,
string_id int(11),
page varchar(128),
lang varchar(10),
translation text
);
you just add that table , run the dataobjects generator, and use
// setting values..
require_once 'Translation2/Admin.php';
$trd = &new Translation2_Admin('dataobjectsimple');
//$trd->setDecoratedLang('en');
$trd->createNewLang(array('lang_id'=>'en'));
$trd->createNewLang(array('lang_id'=>'it'));
$trd->add('small test', 'test.html', array(
'it' => 'piccolo test',
));
Reading stuff...
require_once 'Translation2.php';
$tr = &new Translation2('dataobjectsimple','');
$tr->setLang('it');
$tr->setPageID('test.html');
echo "TRANSLATION: ". $tr->get('small test');
** Did you want it uploaded to CVS?
BTW you dont need DIRECTORY_SEPERATOR in include/require - php sorts that out for you..
Regards
Alan
--
Can you help out?
Need Consulting Services or Know of a Job?
http://www.akbkhome.com