How should the translation work when the cookie with the language is not
saved ?
You should first find the problem why your cookie is not saved.
Still you need to have a workaround as many people don't allow to store
cookies.
Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com
----- Original Message -----
From: "Er Galvao Abbott" <gal...@phpbr.com.br>
To: <fw-general@lists.zend.com>
Sent: Friday, February 13, 2009 6:41 PM
Subject: [fw-general] Problems with cookies and translations
Greetings.
I'm very new with ZF so please excuse any ignorance on my part.
I'm developing a website that must have multiple languages for the user to
choose (namely: en_US, and pt_BR). The idea is having icons present in all
pages that the user can click, resulting in:
1) Change the default locale for him.
2) Rendering the page where he's in again, so he sees that page in the
desired language "automatically".
3) Setting a cookie so the next time he visits the site the correct locale
is already set
Although this might sound pretty straightforward I must confess I'm
completely confused.
The translation works fine in the page's initial load (it loads in English
because my browser's locale is en_US), but it doesn't work after the
redirect. After the user clicks the icon (in this example, the icon for
pt_BR) the page loads without rendering the view and instead of the
translated strings I get only the indexes for the language array ('title',
'phone', 'explain', etc...).
I've also noticed that the cookie is not saved.
Here's how I'm trying to achieve this (this will be simple to show, since
the site has just a front page for now):
app/controllers/IndexController.php - http://paste2.org/p/146862
app/views/scripts/index/index.phtml - http://paste2.org/p/146866
(BTW, the registry is being set in my bootstrap).
Any ideas on what I'm doing wrong?
TIA,
Galvao