Thursday, December 31, 2009

Re: i18n and anonymous surfers - bug?

Using CakePHP 1.2.5 with medium security.

anonymouse.org removes the HTTP_ACCEPT_LANGUAGE information from the
browser, thus CakePHP can't determine the default language to use.

Add the code below to the AppController beforeFiler method to ensure
that a default language is used.
[code]
if ( !isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) {
Configure::write('Config.language', 'eng'); // <== my
default language!
}
[/code]

That works with my development site. Enjoy,
John


On Dec 31, 12:42 am, euromark <dereurom...@googlemail.com> wrote:
> i should probably add:
> security level is to low (as there are strange happening with higher
> security levels anyway)
>
> if nobody has a reason/solution i am forced to open a ticket for this
> i guess
>
> On 30 Dez., 15:47, euromark <dereurom...@googlemail.com> wrote:
>
> > right
> > i think this must be some bug in the core
> > although i could not figure out where it happens
>
> > my version is the 1.3 head right now
>
> > On 30 Dez., 11:08, John Andersen <j.andersen...@gmail.com> wrote:
>
> > > I can confirm this. Just tried it with my development site, which
> > > works well in english and danish, depending on the language
> > > information received from the browser.
> > > With anonymouse.org this completely does not work, nothing is
> > > translated.
> > > Enjoy,
> > >    John
>
> > > On Dec 29, 5:38 am, euromark <dereurom...@googlemail.com> wrote:
>
> > > > i would have never found that out if i hadnt built myself a bot-
> > > > tracking component
> > > > it basically logs all non-js-browsing and tries to detect if it was a
> > > > known search bot
>
> > > > anyway
> > > > this way i found out that my website has been visited by users usinghttp://anonymouse.org/
>
> > > > i tried it out myself and was really shocked that i18n doesnt work
> > > > anymore
> > > > from my understanding it uses (at least in cakephp1.2 it did and
> > > > should do it in 1.3)
> > > > a) define('MY_DEFAULT_LANGUAGE','de');
> > > > b) Configure::write('Config.language', 'de-de')
>
> > > > right now it does not translate at all if you visit it via services
> > > > like anonymouse.org
> > > > neither english nor german nor any other language
>
> > > > Configure::read('Config.language') returns NULL (and was definitely
> > > > set before)
> > > > which could lead to the false assumption that my website is not german
> > > > (although its the main language - and the only present language in the
> > > > po files!), or even worse: buggy and defect. i mean, the untranslated
> > > > strings are appearing...
>
> > > > after some research i found out that this service scambles the cookies
> > > > before passing them to the cake app
> > > > so this might have something to do with it - it is probably like
> > > > cookies beeing deactivated
>
> > > > right now i intercept any call from this service via 406 error code
> > > > and the message "With such services the page cannot be displayed
> > > > properly"
> > > > but it should probably get fixed somehow
> > > > the "primary" language should always be active - even with cookies off
> > > > etc
> > > > any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: