|
|||
|
In my application I have email objects that basically (simplified version below) consist of
Code:
class Template
{
public $TemplateID;
public $Subject;
public $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' |
![]() |
| Thread Tools | |
| Display Modes | |
|
|