I'm using PHPTAL in my project I'm able to successfully implement it almost all the cases except when I want to use its i18n services. I constantly get errors "Call to a member function on a non-object"
I've tried searching the net forums etc. but not found any solution, will really appreciate if somebody can help me out.
Its heartily disappointing that no one answered my question so here I'm finally with the solution and answering my own question.
By default there is no translator set by PHPTAL in order to translate your text from one language to another. So you've to do it on your own. There are some steps give below to do this . . .
Step 1. Create a new php file( e.g. MyTranslator.php ) and generate a new class for example PHPTAL_MyTranslator and store it inside the PHPTAL folder. This class will implement the interface PHPTAL_TranslationService. There are five functions in this interface but the function of our concern is only translate. So just add a declaration for rest of the functions and write code for the translate function. The class I've written and used in my case is :
Step 2. Now open the PHPTAL.php file and modify the constructor of PHPTAL class. Add a line to this function as shown below . . . . .
Before
AfterThese two simple steps will make your i18n:attributes as well as i18n:translate attributes to work properly.
Cheers...