It took me awhile to track thisd info down about using i18n in CakePHP
1.2 but here are my notes.


Internationalization (i18n)

    * at top of controller: uses('L10n');
    * create /app/locale/eng/LC_MESSAGES/default.po (French is fre/
fra)
          o http://www.loc.gov/standards/iso639-2/php/code_list.php
    * create entries in default.po as such:

    msgid  "close_window"
    msgstr "Close"

    msgid  "where_pin"
    msgstr "Where is my PIN?"

    * call translations in view: <?__("close_window")?> )
("close_window" is msgid from default.po)
          o this is going to echo out the msgstr for the given msgid,
else it wil display the msgid given
          o use __("button_submit", true) to return the value as
opposed to echoing it

On May 5, 7:34 pm, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
> I have $_SESSION['Config']['language'] set to my desired language but
> i18n::translate doesn't even seem to have access to $_SESSION?. I've
> done a pr($_SESSION) at line 114 of i18n.php and it returns blank. If
> I do a pr($_SESSION) in a view it works fine. Any ideas?
>
> On May 5, 6:08 am, CraZyLeGs <[EMAIL PROTECTED]> wrote:> you probably mean 
> $_SESSION['Config']['language']
>
> > On May 4, 2:08 pm, misho <[EMAIL PROTECTED]> wrote:
>
> > > Well Yes,
> > > I do some checks on allowed languages, but I don't have a separate
> > > controller to deal with this.
> > > Just scan URL into function (in app_controller.php) and then redirect.
>
> > > And thank you I do not know that Configure::write('Config.language',
> > > 'en') and $_SESSION['Config.language'] are actually the same.
>
> > > On May 4, 2:35 pm, jitka <[EMAIL PROTECTED]> wrote:
>
> > > > - if You will store selected language in session, route url '/language/
> > > > *' to some controller->action and do 
> > > > $this->Session->write('Config.language', $arg); in it (probably with 
> > > > check if this
>
> > > > lng is allowed) - then redirect to referer
>
> > > > - if You will save Config.language in session, You don't have to use
> > > > Configure class (session takes precedency)
>
> > > > - /app/locale/<LANG>/LC_MESSAGES should be /app/locale/<LOCALE>/
> > > > LC_MESSAGES - see L10n::$__l10nMap (locale != language)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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