eqilibrium Posted July 21, 2009 Share Posted July 21, 2009 Hello,Recently I found that is possible to tell browsers what language to show from our shop (if we have it translated in more than one language of course).The problem is that the solutions I saw didn't work for me. So, I was wondering if there is someone that knows something about this.I'm giving an example of the code: $langue_user=substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2); Found it in the french forum: http://www.prestashop.com/forums/viewthread/20195/discussion_generale/selection_automatique_de_la_langue_suivant_langue_navigateur/Thank's Link to comment Share on other sites More sharing options...
eqilibrium Posted July 21, 2009 Author Share Posted July 21, 2009 Well, it seems that hard work pays off. Finnaly I got it.For anyone out there with this "problem", just put this piece of code:<% response.write(Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"))%> In header.tpl of your theme folder, just after the first 2 lines and before the tag <head>.Bye ;-) Link to comment Share on other sites More sharing options...
Ehinarr Posted July 21, 2009 Share Posted July 21, 2009 Wow. You are amazing! lolThanks Link to comment Share on other sites More sharing options...
ZuZu Posted August 5, 2009 Share Posted August 5, 2009 Hi,I use Dutch and English in my shop, default language is Dutch. What would happen if the browser being used is German for example, would the shop be set to the default language? If so, is it possible to automatically set the shop to English if the browser is not Dutch?Thanks! Link to comment Share on other sites More sharing options...
eqilibrium Posted August 5, 2009 Author Share Posted August 5, 2009 Hi ZuZu,When the user's browser doesn't correspond to any of the languages you have translated on your shop, then he or she will see it in the default language that you defined in B.O. Link to comment Share on other sites More sharing options...
ZuZu Posted August 5, 2009 Share Posted August 5, 2009 thanks for your reply. I've adjusted header.tpl but it didnt work. I put <% response.write(Request.ServerVariables(“HTTP_ACCEPT_LANGUAGE”))%> as the 3rd line in my header.tpl and above <head>. Also when testing in Firefox the code <% response.write(Request.ServerVariables(“HTTP_ACCEPT_LANGUAGE”))%> showed as text in my shop.... What did I do wrong? Link to comment Share on other sites More sharing options...
eqilibrium Posted August 5, 2009 Author Share Posted August 5, 2009 Hi,I'm going to give you the image of the exact code I use.If you don't put the code in the exact same place, is going to appear on firefox, opera and others.Forgot to say that this file is the header.tpl of your theme. Link to comment Share on other sites More sharing options...
ZuZu Posted August 6, 2009 Share Posted August 6, 2009 Hi, I did exactly as you described (see illustration) and selected "English (United Kingdom) [en-GB]" as the default browser language in IE... but it doesn't work. The shop keeps appearing in it's default language (Dutch). Is header.tpl the only file that needs to be adjusted?Thanks! Link to comment Share on other sites More sharing options...
Dio Posted August 6, 2009 Share Posted August 6, 2009 Its working! Thanks m8! Link to comment Share on other sites More sharing options...
eqilibrium Posted August 6, 2009 Author Share Posted August 6, 2009 Hi Zuzu,You have to go to the IE Tools/options/Languages and remove dutch from your favorite languages or else of course is going to keep apearing in your default language. Clean cache and cokies also, because your website already "knows you".After you have cleaned the languages, cache and cookies , only than should you enter your website.Clean it and then tell me how it went ;-) Link to comment Share on other sites More sharing options...
ZuZu Posted August 6, 2009 Share Posted August 6, 2009 Forgot to mention but I already cleaned all caches (cookies, temp. internet files, browsing history etc) and English is the only selected language. I've tried the other way around also: put English as default in Prestashop and Dutch as default browser language, but no luck there either. :down: I don't get it... Link to comment Share on other sites More sharing options...
eqilibrium Posted August 6, 2009 Author Share Posted August 6, 2009 Give me your url so I can see it Link to comment Share on other sites More sharing options...
ZuZu Posted August 6, 2009 Share Posted August 6, 2009 www.lxdrums.eu/Webshop Link to comment Share on other sites More sharing options...
eqilibrium Posted August 6, 2009 Author Share Posted August 6, 2009 Well, something wrong is going on... I've looked into the source code of your web and the code is how it should be, so something is missing in there. Try to see if you gave enough permissions to this file (header.tpl)Right now, I can only see the CHMOD as the most obvious reason. Anther thing, you do not have the url rewriting turned on, is it on purpose?Just asked you this because, as we all know, sometimes we get errors without any obvious reazon, so, just remembered this detail.Truethfully speaking, it can be just a small detail, you have to try here and there till you find it.But firt of all, go and CHMOD header.tpl to 777 and then try again (after cleaning cache, etc.) Link to comment Share on other sites More sharing options...
ZuZu Posted August 6, 2009 Share Posted August 6, 2009 The file already had CHMOD 777... but thanks for all your help! Hopefully there's someone out there who has the breakthrough idea?About URL rewriting, how do I turn that on? Thanks again! Link to comment Share on other sites More sharing options...
eqilibrium Posted August 6, 2009 Author Share Posted August 6, 2009 In your Back Office: Preferences: look for "Friendly URL:" Say Yes.Then, you will have to rename the .htaccess.txt file to .htaccess (this file is in your root folder:webshop I gess)This way, you can give your categories and products URL's the names you want so that you can achieve a bette position in google search. Link to comment Share on other sites More sharing options...
ZuZu Posted August 6, 2009 Share Posted August 6, 2009 OK URL rewrite works: thanks!Hope to solve the language selection too! I'll keep you posted! Link to comment Share on other sites More sharing options...
eqilibrium Posted August 8, 2009 Author Share Posted August 8, 2009 Hi Zuzu,I discovered that the other day I had my browser with no english definied, so, today I add it and visited your shop again. Guess what? Your page shows up in english, not it duch. Link to comment Share on other sites More sharing options...
ZuZu Posted August 9, 2009 Share Posted August 9, 2009 It still isn't working for me.... did you maybe click on the UK flag before adding English as default language? Once I select English by clicking on the flag, it sticks to English. Thanks for still trying! Link to comment Share on other sites More sharing options...
eqilibrium Posted August 9, 2009 Author Share Posted August 9, 2009 For testing purposes, I use Opera browser, and I never store any data in there. I do not have a single cookie or file stored, is 100% empty.So, to test your shop, I came here and did copy paste in Opera, with english as one of my prefered languages and your site appeared in english.Went there now to see it again and was in english. The only way it does not show in english is when I delete that language from my browser preferences.In conclusion, the problem is in your browser, not you site. If you had an alternative browser set to english as default lang. and without Duch in it, of course, maybe it would help you see.Now, Very Important Thing: it seems that /webshop is a redirect, "www.lxdrums.eu" is the main page, so, this is most probably what is causing you this problem; you have to put the tag in this first page also, because this is the main page of your domain (I'm gessing this file must be in the filesystem root: "Index.php".As this first page doesn't have the tag, even I can't see it in english. Link to comment Share on other sites More sharing options...
ZuZu Posted August 9, 2009 Share Posted August 9, 2009 Hi,I think I know why it isn't working. I've downloaded Opera too and it worked. I noticed that Opera uses the 2 digit ISO code for language settings ( EN for English ). I then replaced my Firefox 3.0 for the latest version and choose EN as the default language: it worked. Now, if I select a 4 digit language code in Firefox, for instance EN-US, it doesnt work. Internet Explorer only uses 4 digit languages codes. Now I have to find a way to get Prestashop to get this... :-) Link to comment Share on other sites More sharing options...
Ann Posted August 9, 2009 Share Posted August 9, 2009 Hi guys, I put the code in my header, can you tell me whether it is working ok ? ThanksAnn Link to comment Share on other sites More sharing options...
ZuZu Posted August 9, 2009 Share Posted August 9, 2009 Same thing as on my site: if I use the 2 digit code EN it works, if I use the 4 digit code EN-US it doesn't. (your default language is French)Wouldn't it possible to do something as was described in the French forum, but then in the header.tpl? (I tried EN-US in the header.php but that didnt work)http://www.prestashop.com/forums/viewthread/20195/discussion_generale/selection_automatique_de_la_langue_suivant_langue_navigateur/ Link to comment Share on other sites More sharing options...
Recommended Posts