Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PROBLEM I18N multilanguage plugin (menu and content switch)
#1
Hello,

I'm trying to create a multilanguage site with I18N plugin. Everything works fine expect for one annoying issue.

When I press a link/button in my site to change the whole language of my site, the menu and current page content change OK to the other language. However, when I press then another menu item, it loads the page content of the other (last) language and changes the menu back to the other (last) language too.

It seems like the navigator or server has cached the last menu and page access (in the previous language). My intention is to remain for example in the http://mysite?setlang=en for the rest of contents until I press the language link/button again.

I only get this if I remain in the current page after selecting the language link/button. This obly users that access my site to click the language link/button everytime after they select a menu page in the other language.

I tried also to install other cache plugins found in GetSimple CMS site and also added this to my root 'htacces' without any success (I found this in other PHP forum):

<FilesMatch "\.(php)$">
<IfModule mod_expires.c>
ExpiresActive Off
</IfModule>
<IfModule mod_headers.c>
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
</IfModule>
</FilesMatch>

Here is my site (in construction): http://personal.us.es/dcagigas

In the attachment you can see all the I18N plugin options I've tried (under comments) in my 'template.php'.

I have not found a similar question to my problem in the forum and I tried many things and I18N derived plugins. I'm not sure if this could be a server (hosting) configuration problem.

Any help or clue will be very appreciated.
I'm really stuck.
GetSimple CMS is great and fits very well my needs, but without solving this problem I'll have to find another solution.

Thanks in advance,

Daniel


Attached Files
.php   template.php (Size: 5.12 KB / Downloads: 6)
Reply
#2
(2014-08-29, 04:56:09)dcagigas Wrote: I'm trying to create a multilanguage site with I18N plugin. Everything works fine expect for one annoying issue.

When I press a link/button in my site to change the whole language of my site, the menu and current page content change OK to the other language. However, when I press then another menu item, it loads the page content of the other (last) language and changes the menu back to the other (last) language too.

You definitely have a caching issue, although it seems to have improved in the last minutes. The The "Expires" header seems to be fine now, but still there is a "Cache-Control: max-age=604800" entry in the header.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
(2014-08-29, 23:27:16)mvlcek Wrote: [quote='dcagigas' pid='47338' dateline='1409252169']

You definitely have a caching issue, although it seems to have improved in the last minutes. The The "Expires" header seems to be fine now, but still there is a "Cache-Control: max-age=604800" entry in the header.

Thank's for the rapid answer.
That's what I suspected but not 100% sure.
I modified the root 'htaccess' file and added at the end (in bold):

<FilesMatch "\.(php|html|html)$">
<IfModule mod_expires.c>
ExpiresActive Off
</IfModule>
<IfModule mod_headers.c>
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform, max-age=0"
</IfModule>
</FilesMatch>

Now 'Request Headers' show 0, but the problem persist. Maybe because 'Response Headers' still say 'Cache-Control:max-age=604800'.

Is there anything else that it can be done before contacting my system admins?

Regards,
Daniel
Reply
#4
Hi,

I will answer my own problem/question. It was definitely a cache problem. Now the web site works much better with the I18n multilingual plugin (a great plugin).

I think performance and response time could be improved with other cache plugins in the future. But for a basic operation is enough.

Below is the right code to add to .htacess in order to avoid caching problems. I took it from another forum. This solution is at least valid to discard side effects in plugins with the cache system.

<FilesMatch "\.(php|html)$">
<IfModule mod_expires.c>
ExpiresActive On
</IfModule>
<IfModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</IfModule>
</FilesMatch>

One final remark/conclusion:

I think it is important to point out this sort of issues in plugins description/installation because sometimes some cache extra configuration can be mandatory. Hosting services and Apache server configurations are not usually homogeneous.

Thanks again for helping me to solve the problem. I hope this will be useful to future GetSimple CMS users.

Regards,
Daniel
Reply
#5
(2014-09-01, 19:26:09)dcagigas Wrote: I think it is important to point out this sort of issues in plugins description/installation because sometimes some cache extra configuration can be mandatory. Hosting services and Apache server configurations are not usually homogeneous.

PHP serves dynamic pages, so in general you must not cache PHP content, and a Apache configuration caching PHP pages is definitely faulty. For the same reason you should not use a .html extension in your fancy URL setup, as Apache or proxies between your server and the visitor might cache the page.

As for a multi-language setup, you can also use fancy URLs with the language in the URL, which would allow you to cache the pages, if you don't use any dynamic content, don't expect to see changed page content immediately, don't have a search functionality, no blog, etc.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply




Users browsing this thread: 1 Guest(s)