Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-19-2008, 10:12 PM
Junior Member
 
Join Date: May 2008
Posts: 1
Default Translating text within objects?

In my application I have email objects that basically (simplified version below) consist of

Code:
class Template
{
    public $TemplateID;
    public $Subject;
    public $Body;
}
At the moment I have each of these objects saved to a database table that has roughly the following columns: TemplateID, LanguageType, Subject, Body.

I was thinking of going over to use Zend_Translate but wanted to see if there was a good way to get automatic translation of objects. I have two ideas but I'm not sure how good they are and wanted to see if there was any opinion or even a better solution.

I will provide an interface so that I admins will be able to see the default text and enter the translated equivalent and save it. I basically want to see the way I'm storing the translated is correct or if there is a better way of doing it.

Solution #1.
Using gettext adapter, add a serialized version of the object (say translated into italian) to an italian gettext encoded file, using the key 'TEMPLATE_12' (if the TemplateID was 12). So when I create this object, it tries to retrieve the italian text from the gettext file, if it finds it it unserializes the translated text and assigns it to the object variables, if it doesn't find it, it pulls the default text form the db.

Solution #2.
Using the method as above except instead of storing a serialized object/array of translated text under the message_id 'TEMPLATE_12', I would break each part into separate strings. e.g. 'TEMPLATE_12_SUBJECT' and TEMPLATE_12_BODY'
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:19 PM.