Jump to content

[SOLVED] Cant change default language


Recommended Posts

Hello

 

Prestashop 1.6.0.5:

(Fresh install)

 

I cant change the default language as its (of course) is not possible to delete or inactivate the default language.
I have installed a new language, but there is no option here to choose it as default language - neither there on in the language menu.

Thus I cannot inactive or delete english and choose a new language as default.

Am I missing something?

 

Great system btw!

 

 

Link to comment
Share on other sites

Hello

 

Prestashop 1.6.0.5:

(Fresh install)

 

I cant change the default language as its (of course) is not possible to delete or inactivate the default language.

I have installed a new language, but there is no option here to choose it as default language - neither there on in the language menu.

Thus I cannot inactive or delete english and choose a new language as default.

Am I missing something?

 

Great system btw!

 

open this tab in your back office:

localization > localization

 

 

Zy0eAvE.png

Link to comment
Share on other sites

  • 3 months later...

Hi,

 

I'm new to prestashop & i am using prestahop_1.6.0.8 & I expect my shop in french. 

I have even set the default language to french in the dashboard/back office. But It aint working. Please help. I have attached the screenshots below.

 

post-813498-0-74999200-1404480612_thumb.png

Link to comment
Share on other sites

hello

perhaps your browser use english language and while you open your shop it is in english.

clear shop cache,

clear browser cache

 

and check your front office.

 

also try with different browsers where default language (in browser) is different.

Link to comment
Share on other sites

  • 4 weeks later...

Same for me:  "FR" is the default language

 

When I try to access "naturelore.com" using incognito mode with Chrome :

it leads to naturelore.com/en/

 

How to change that so that it goes to .../fr/ ???

 

Thanks

 

Howdy, I set my default language browser to French, visited your shop and it defaulted to French.

 

TIP: PrestaShop will detect browser language and if present in shop, use that language.  So change your 'first' choice of browser language to French, clear cookies for that domain, re-visit.

Link to comment
Share on other sites

Hi,

Thanks, Yes I know.

Are you sure that all French will see the website in French first?

I was astonished that with incognito mode I was geared to .../en/ , why?

 

Another question: ....com is redirected to ....com/fr

it seems to be bad for webmaster tools, is it?

  • Like 1
Link to comment
Share on other sites

Hi,

Thanks, Yes I know.

Are you sure that all French will see the website in French first?

I was astonished that with incognito mode I was geared to .../en/ , why?

 

Another question: ....com is redirected to ....com/fr

it seems to be bad for webmaster tools, is it?

hi, I don't know incognito.

 

I can't say about redirect.  you may want to post new forum topic

Link to comment
Share on other sites

"incognito" just means you browse without sticking history and cookies, nothing mysterious.

 

 incognito is a good way to see your website responding to google search, otherwise google is pleasing you in putting you on first page, but it's fake and only for you !!!

 

With Chrome you press "cmd+shift+N" (on a Mac) and there you are.

  • Like 1
Link to comment
Share on other sites

So the question still is.

Is there a way to bypass the default function from Prestashop which detects the visitors browser language.?

I want to force my visitors to always see Swedish language even though they are using, whatever language in there browsers. Although they should have the option to choose "English" or any other language in the dropdown.

Like myself i never use Swedish browser even though i am swedish and live in sweden.

  • Like 1
Link to comment
Share on other sites

So the question still is.

 

Is there a way to bypass the default function from Prestashop which detects the visitors browser language.?

 

I want to force my visitors to always see Swedish language even though they are using, whatever language in there browsers. Although they should have the option to choose "English" or any other language in the dropdown.

 

Like myself i never use Swedish browser even though i am swedish and live in sweden.

 

You can try this, it's a bit wild ... : 

 

edit the file:  yourwebsite/classes/Guest.php   (take a safe copy first)

 

   For Prestashop 1.6.0.8 (I haven't checked for the other versions)

 

line 79:  $acceptLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';

==> replace by   $acceptLanguage = 'xx';

// xx being your Swedish language code

 

line 95:                          $langsArray[$lang] = 1;

==> replace by   $langsArray[$lang] = n;

// n being the language ID number given by Prestashop, for Swedish

 

Don't forget this change will be erased each time you update to a new release of Prestashop.

 

Note: this does not change the language cookie which is managed in .../classes/Tools.php line 333...

         so this is valid for a new guest or one having cleared his cookies.

          i.e.: if a guest change the language he will still be directed to this language thereafter.

 

Good luck.

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

Thanks rfourt

There are some little side effects after these modifications I made today:

- cannot change the BO language, always in the default language, bizarre

- it may change the behaviour of modules using directly the browser language.

 

To be checked, waiting your results.

 

René

Link to comment
Share on other sites

Hi Fred,

Agree with you about modifs to the core, but hey ;-)

When you have a wedsite targeting non EN language this subject is hot because most people use their browser in english, and as your website is optimized for say FR, you want guests to be welcome in FR first.

After that if they change language they will stick to it.

 

My modifs lead to this behaviour, will see if there is no other annoying side effect like the language in the BO.

 

Cheers

René

Link to comment
Share on other sites

Hi Fred,

Agree with you about modifs to the core, but hey ;-)

When you have a wedsite targeting non EN language this subject is hot because most people use their browser in english, and as your website is optimized for say FR, you want guests to be welcome in FR first.

After that if they change language they will stick to it.

 

My modifs lead to this behaviour, will see if there is no other annoying side effect like the language in the BO.

 

Cheers

René

 

Your point is very valuable, i.e.there are many with different requirements by community.  I have to write for general community who read later so that they know what if any issues may happen. suerte.  I am kicking around a some new development in this arena.

  • Like 1
Link to comment
Share on other sites

Thnx again..

And "El Patron"  you bring out a important thing there about SEO.

But as i said most people i know use a browser in English even if they are from Sweden or Turkey, but in my line of business for what im selling my customers would feel alot safer if the site is presented directly in swedish as most of my customers are over the age of 40 i think many would feel insecure if the first page is presented in English.

But lets say i use a English browser and i only have Swedish and Norwegian language installed i guess its going to pic Swedish if i have set that to default language even though i enter with an English browser.?

Link to comment
Share on other sites

  • 1 month later...

Hi rfourt,

 

After I have struggled with this problem, I found a way to stop Prestashop 1.6.0.9  from automatic language detection and change to browser selected language. This helped me to stop Location Detection & Redirect users to their browser language automatically.

 

First back-up the files: Cookie.php and Tools.php

 

1. Modify site/classes/Cookie.php  >> on line 307
 

   $this->detect_language = true;   with
   $this->detect_language = false;

 

2. Modify site/classes/Tools.php >> on line 350 and at the end of the line 368 add    /* */

   

/* Automatically detect language if not already defined, detect_language is set in Cookie::update */

/* if ((!$cookie->id_lang || isset($cookie->detect_language)) && isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$array  = explode(',', Tools::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
$string = $array[0];
 
if (Validate::isLanguageCode($string))
{
$lang = Language::getLanguageByIETFCode($string);
if (Validate::isLoadedObject($lang) && $lang->active && $lang->isAssociatedToShop())
{
Context::getContext()->language = $lang;
$cookie->id_lang = (int)$lang->id;
}
}
}
 
if (isset($cookie->detect_language))
unset($cookie->detect_language); */
 
 I haven't tested it very intensively, but it seems to work.  
 
PS: Don't forget to change default language in Prestashop BO to your desired language and delete browser cookies. 
  • Like 5
Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
  • 4 weeks later...
  • 3 weeks later...

hi dear

I am facing the same problem with my prestashop 1.6.0.11 I have installed prestashop in English language might be not sure but now I am using other account web linker software with my prestashop in Spanish language and want to change my installed prestashop language in Spanish. is it possible to change the language permanently.

 

can anyone help me for this matter.

 

 

waiting for reply

Link to comment
Share on other sites

×
×
  • Create New...