Jump to content

[TIP localization] Use IETF code to set language of shop, not 'iso'


Recommended Posts

It's best to detect and set shop language based on visitors language as passed by their browser.

 

PrestaShop included browser language detect since 1.4 but it had a bug and was never executed.

 

This but however was resolved in 1.5.6 the execution where language detect by browser worked.  This to many shop owners surprise when they upgraded to 1.5.6.

 

The 1.5.6.1 logic looked at the ISO code (language code), i.e. en fr de es.  (Note: this code is what you see in your browser URL's) and not the country.

 

This causes problem for shops that have the same language but differ country:

 

en-US US

en-GB UK

es-ES

es-MX

 

This fix goes a long way to setting correct shop language.

http://forge.prestashop.com/browse/PSCFV-10876

 

useful links by eyespypro

http://www.prestashop.com/forums/topic/288150-ietf-language-tag/

 

Happy localizing.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hey

 

How do i backport this functionality to v1.5.4.1?

 

thanks

 

Hi, you would need to apply the github code for classes/Language.php and classes/Tools.php

 

I have installed these changes on customers shops the latest ps version it worked for was 1.5.3.1

 

https://github.com/djfm/PrestaShop/commit/8e4faaa23b2f0b0bec3543b3f849ff95afbf2e22

 

Make sure to back up your files. 

Link to comment
Share on other sites

  • 3 months later...
  • 5 months later...

one of my area's of interest has been working with native PrestaShop localization.  Because native will only check the first visitor language and if not found use shop default, I have extended logic to also look at all languages passed by http_accept_language.  As an added beneift we also included setting the currency based on visitor location.

 

so for example we can support (I prefer Danish, but if not available the following langues in order of preference are also acceptable).

 

http://www.prestashop.com/forums/topic/349727-module-advanced-visitor-language-currency-localization-ietf/

Link to comment
Share on other sites

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...