google-code-export / digitalus-cms

Automatically exported from code.google.com/p/digitalus-cms
1 stars 1 forks source link

Changing language in the front-end affects translation only after refresh #142

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
I have a multilanguage site. I'm using in the layout template:
echo $this->getTranslation('Home'); ?
to display text labels
and also
echo $this->translate()->getLocale()
because I have language-specific images, that contain the language code in
the file path
When I change language via URL /p/language/en/
the content (pages, menus) is translated in the new language immediately,
while labels and getLocale() code are set to the new ones only on refresh.
It seems that the template is being parsed before querying the database,
and the new locale is set in the model, while querying the database.

What steps will reproduce the problem?
1. Add echo $this->translate()->getLocale() to the 
templates/public/default/layouts/2-column-left.phtml 
2. change the language to some other, for example de
3.

What is the expected output? What do you see instead?
the echoed getLocale() should be de. It stays en, and if you refresh the
page, it's changed to de

What version of the product are you using? On what operating system?
svn, checkout about a week ago 

Please provide any additional information below.

Original issue reported on code.google.com by Darha...@gmail.com on 5 Mar 2010 at 3:29

GoogleCodeExporter commented 9 years ago
ok, I've merged with r703 and echo getLocale() returns the correct locale, but 
the 
translated strings are still in the old language until refresh. This is 
probably some 
king of caching issue, although it's in a development mode and cache should be 
disabled.

Original comment by Darha...@gmail.com on 6 Mar 2010 at 11:06

GoogleCodeExporter commented 9 years ago
Caching is disabled in 'development' mode.

Have a look at /application/Bootstrap.php line 156ff.:
if ('development' == APPLICATION_ENV) {
    $frontendOptions['caching'] = false;
}

I'll see if I can reproduce this behaviour.

Cheers,
LT.

Original comment by lowtower1974@gmail.com on 7 Mar 2010 at 5:00

GoogleCodeExporter commented 9 years ago

Original comment by lowtower1974@gmail.com on 28 Apr 2010 at 2:31

GoogleCodeExporter commented 9 years ago
Fixed with r743

Original comment by lowtower1974@gmail.com on 28 Apr 2010 at 3:41