Ok problem solved is that my PHP was not compiled with gettext. So
thats done. The page loads but there is not message being displayed.




On Aug 17, 4:52 pm, RhythmicDevil <[email protected]> wrote:
> Hi,
> I am trying to understand how to get internationalization to work in
> CakePHP. After reading the docs and searching around, looking at
> Teknoid and some other place this is what I am left with.
>
> CakePHP has a class I18n that handles the loading of the correct
> string from a .po file based upon the language locale setting.
>
> CakePHP has a console app that supposedly will read all the strings in
> your view files and create language files for you.
>
> I wrap my string ids in _() which will return the msg for that id.
>
> I can use POEdit to create my files.
>
> Given that. I created one message and placed it in the default.po file
> for English. I then used the translator function for the heading on my
> login page. However when I start the app it simply fails and tells me
> that _()  is an undefined function.
>
> Here is the content of my controller:
>
> class SubscribersController extends Controller
> {
>     public $helpers = array ('Form', 'Html', 'Javascript');
>     public $components = array ('DataPrep');
>
>     public $SubscriberId = null;
>
>     public function login()
>     {
>         $this->pageTitle = 'Please Login';
>         $this->layout = 'login';
>         $this->SubscriberId = $this->params['data']['Subscriber']
> ['SubscriberId'];
>         $this->log('Login attempt with SubscriberId: '.$this->SubscriberId, 
> Configure::read('APP_LOG'));
>
>         $subscriber = $this->Subscriber->QuerySub($this->SubscriberId);
>
>         if ($subscriber->resultCode == 0)
>         {
>             $this->Session->write('Subscriber', $subscriber->querySubRsp);
>
>             //debug($this->Session->read('Subscriber'));
>             $this->redirect( array ('controller'=>'subscribers',
> 'action'=>'basics'));
>         }
>
>     }
> ............
>
> Here is the content of my View file:
>
> <div class="grid_6">&nbsp;</div>
>         <div class="grid_4" style="margin-top:200px; background:#FFF;">
>                 <div style="text-align:center; font-weight:bold;"><?php 
> _("Please
> Login"); ?></div>
>                 <div style="padding:20px;">
>
>                 <?php
>                         echo $form->create($options = array('action' => 
> 'login'));
>                         echo $form->input('Subscriber.SubscriberId');
>                         echo $form->button('Login', array('type'=>'submit',
> 'class'=>'button'));
>                         echo $form->end();
>                 ?>
>                 </div>
>         </div>
> <div class="grid_6">&nbsp;</div>
>
> Here is the content of my default.po file that is in the directory /
> app/locale/eng/LC_MESSAGES/
>
> msgid ""
> msgstr ""
> "Project-Id-Version: \n"
> "POT-Creation-Date: \n"
> "PO-Revision-Date: \n"
> "Last-Translator: Steven Wright <[email protected]>\n"
> "Language-Team: \n"
> "MIME-Version: 1.0\n"
> "Content-Type: text/plain; charset=iso-8859-1\n"
> "Content-Transfer-Encoding: 8bit\n"
>
> msgid "Please Login"
> msgstr "Please Login"
>
> 1) I am assuming I need to tell Cake to use I18n. But how? Is it a
> component, a helper?
> 2) Does my .po file look correct?
> 3) Am I on the right path?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to