Jump to content

Default language not always the same.


Recommended Posts

Hello,

I've met a problem and don't know how to resolve it.

My temporary site is at http://workshop.freshbrand.lt/presta

Problem is that I've set default language Danish. And not for all users home page opens in Danish language.

For example form one computer I with firefox opens Danish, But with chrome English.

I want to set default Dalish language and disable language block, that main language would be Danish, but I would be able administrate it in English.

Maybe someone could offer me a solution.

Thank you in advance ;-)

Link to comment
Share on other sites

This, arguably, seen as a feature (see the bug report) by some. How it works is:

For visitors with no previous cookie the language matching the Accept-Language header is served. If the visitor changes the language then this preference is saved in the cookie and the language that matches the one encoded in the cookie is preferred over Accept-Language header and served in subsequent visits. If neither a cookie nor Accept-Language header exist, then the default language is served.

In summary, this is the current situation

Cookie        Accept-Language        Language served
No                No                    default
No                Yes                Accept-Language
Yes                No                    cookie
Yes                Yes                    cookie

In practise this means, the default language is only served to robots (or if the visitor sent header coincidences with the default language setting). First time visitors and privacy conscious (due to clearing cookies, and more and more nowadays) will see whatever their browser sends as Accept-Language header. The problem with that is, as I said before, the "Default Language" setting is not what it seems to be; if I set the default language to be, say German, I expect visitors who did not explicitly change their language to another one, and preserved that with a cookie, to see German UI.

I am pro-choice and IMHO, the best thing would be to let the shop owner decide what language will be served, as implied by the "Default Language" setting, e.g. say, by providing a checkbox for "Ignore Accept-Language headers" within the Language options. Short of that, one can remove the Accept-Language from the request headers by adding a .htaccess file with the following stanza (or appending it to an existing .htaccess), assuming Apache Headers module is installed

# Remove Accept-Language header (if exists) to really serve
# the "default language" set, for visitors without a cookie

RequestHeader unset Accept-Language

 

Then the above will table will transform to following:

Cookie	Language served
Yes		cookie
No		 default

Edited by phrasespot (see edit history)
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
  • 1 month later...

I have had the same problem.

Prestashop standard Englisch en default Dutch.
Within firefox (english) version the shop is switching to english.
I have not configured the shop in english and i want my shop only in the dutch language.

What did i do??

Go to Admin
Tools
Languages
Disable English (not delete).

And firefox is working with the dutch language.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
This, arguably, seen as a feature (see the bug report) by some. How it works is:

In summary, this is the current situation

[pre]Cookie Accept-Language Language served
No No default
No Yes Accept-Language
Yes No cookie
Yes Yes cookie[/pre]

assuming Apache Headers module is installed


# Remove Accept-Language header (if exists) to really serve
# the "default language" set, for visitors without a cookie


   RequestHeader unset Accept-Language




Then the above will table will transform to following:

[pre]Cookie Language served
Yes cookie
No default[/pre]



this explain the situation very clearly. solved!!
Link to comment
Share on other sites

  • 2 months later...

It's not working for me.

I've added those htaccess lines in my root .htaccess file, but website still have different default language when accessed with different browser.

Chrome & Safari will have website opened in English, while the other browsers will open the website in the correct default language as set in back office.

Is there any different method to fix this issue?

Link to comment
Share on other sites

  • 2 months later...
  • 10 months later...

I've been doing some testing in different browsers and here are the results I am seeing (vers 1.4.7.0)

 

In Google Chrome (and presumably Safari, since they are both Webkit), PrestaShop remembers the last language preference

selected by the user on the next subsequent visit.

(First time visitors always see the DEFAULT language, set in the BO, regardless of browser language preferences).

 

Firefox/Opera on the other hand, do not. They ALWAYS serve up the default language for the site.

Site language preference cookies & browser language preferences appear to make not a iota of difference.

 

In the case of Firefox (and Opera may well be the same) this behaviour appears to be due to the use of DNS caching on my local hardware. DNS caching is a relatively recent "feature" of Firefox to speed up performance but it DOES cause some headache for developers/designers IMHO.

 

Which is why you can test my comments above by downloading a Firefox addon which flushes your DNS cache.

https://addons.mozil...on/dns-flusher/

Edited by TWDesign (see edit history)
Link to comment
Share on other sites

  • 3 months later...

Hi members.

 

I have same problem. I try change .htacces and add RequestHeader unset Accept-Language

 

and got error Internal server error. What wrong? See:

 

 

 

 

 

 

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution

# http://www.prestashop.com - http://www.prestashop.com/forums

 

# URL rewriting module activation

RewriteEngine on

 

# URL rewriting rules

RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2$3.jpg [QSA,L,E]

RewriteRule ^([0-9]+)\-([0-9]+)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2.jpg [QSA,L,E]

RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [QSA,L,E]

RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$3&isolang=$1$5 [QSA,L,E]

RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2&isolang=$1$4 [QSA,L,E]

RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$2&isolang=$1 [QSA,L,E]

RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 [QSA,L,E]

RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [QSA,L,E]

RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 [QSA,L,E]

RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 [QSA,L,E]

RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 [QSA,L,E]

RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]

RewriteRule ^lang-([a-z]{2})/(.*)$ /$2?isolang=$1 [QSA,L,E]

 

# Catch 404 errors

ErrorDocument 404 /404.php

# Remove Accept-Language header (if exists) to really serve

# the "default language" set, for visitors without a cookie

 

 

RequestHeader unset Accept-Language

 

 

 

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...