Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Set Default Language Rate Topic   - - - - -

 
  • victorb
  • Senior Member
  • Members
  • Join Date: 29-Oct 12
  • 181 posts

Posted 26 March 2017 - 02:33 PM #1

how to set one default language for all customers  no matter their region area or their computer preferred language ? 



 
  • BarryH
  • Senior Member
  • Members
  • Join Date: 03-Sep 07
  • 1459 posts

Posted 26 March 2017 - 03:06 PM #2

Hi

 

Admin>Administration>Appearance>Customer Settings>Frontend default language


BarryH

 

CS-Cart v4.4.3 (Plus one being developed v4.5.2 SP2)
UK User


 
  • BarryH
  • Senior Member
  • Members
  • Join Date: 03-Sep 07
  • 1459 posts

Posted 26 March 2017 - 03:11 PM #3

Also....

 

Admin>Administration>Languages>Manage Languages.................. Disable the not required languages


BarryH

 

CS-Cart v4.4.3 (Plus one being developed v4.5.2 SP2)
UK User


 
  • victorb
  • Senior Member
  • Members
  • Join Date: 29-Oct 12
  • 181 posts

Posted 26 March 2017 - 08:51 PM #4

Hi

 

Admin>Administration>Appearance>Customer Settings>Frontend default language

 

Customer setting ->    Frontend default language      it is set corectly  but if instalation on customer computer is in EN language, web-shop will start in English always !

 

 

Also....

 

Admin>Administration>Languages>Manage Languages.................. Disable the not required languages

 

I can not do that because some customers are from abroad and they must have posibility to change to English if they want !

 

I already set language for each customers in their account but same results!   We have two fresh installations of ver 4.5.1 SP1 and same situation 

 

 

others ideas ?

 

tks



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11406 posts

Posted 26 March 2017 - 09:29 PM #5

Language is derived this way:

1) language being used by the browser

2) Any localization that may be setup

3) Default language from store.

 

If languages from 1 & 2 are not enabled then 3 will occur.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19797 posts

Posted 27 March 2017 - 06:59 AM #6

Find the fn_init_language function in the app/functions/fn.init.php and try to replace

} elseif ($_lc = fn_get_browser_language($avail_languages)) {
        fn_define('CART_LANGUAGE', $_lc);

with

} elseif ($_lc = fn_get_browser_language($avail_languages)) {
        fn_define('CART_LANGUAGE', 'en');

where en - is the required language code


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • ThomH
  • Senior Member
  • Members
  • Join Date: 20-Nov 07
  • 1572 posts

Posted 27 March 2017 - 08:12 AM #7

Take a look at GeoIP Languages


WebGraphiq offers a wide range of professionally developed, ready to use CS-Cart add-ons to provide additional functionality and boost your sales. The oldest active CS-Cart add-on development team. -- Since 2006 --


CS-CART ADD-ONS | FREE QUOTE | CS-CART DEVELOPMENT | @webgraphiq


 
  • victorb
  • Senior Member
  • Members
  • Join Date: 29-Oct 12
  • 181 posts

Posted 28 March 2017 - 02:55 AM #8

Find the fn_init_language function in the app/functions/fn.init.php and try to replace

} elseif ($_lc = fn_get_browser_language($avail_languages)) {
        fn_define('CART_LANGUAGE', $_lc);

with

} elseif ($_lc = fn_get_browser_language($avail_languages)) {
        fn_define('CART_LANGUAGE', 'en);

where en - is the required language code

 

Yes this seem to be correct solution, but after modification   appear   HTTP ERROR 500



 
  • victorb
  • Senior Member
  • Members
  • Join Date: 29-Oct 12
  • 181 posts

Posted 28 March 2017 - 02:57 AM #9

Take a look at GeoIP Languages

 

can be a solution but a lot of customers use proxy (I do not understand why) and their location appear to be from others countries/languages



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19797 posts

Posted 28 March 2017 - 06:51 AM #10

Yes this seem to be correct solution, but after modification   appear   HTTP ERROR 500

 

One quotation mark is missed in the code. Correct code:

} elseif ($_lc = fn_get_browser_language($avail_languages)) {
        fn_define('CART_LANGUAGE', 'en');

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • victorb
  • Senior Member
  • Members
  • Join Date: 29-Oct 12
  • 181 posts

Posted 01 May 2017 - 07:18 AM #11

 

One quotation mark is missed in the code. Correct code:

} elseif ($_lc = fn_get_browser_language($avail_languages)) {
        fn_define('CART_LANGUAGE', 'en');

It works perfect! Thanks eComLabs !



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19797 posts

Posted 02 May 2017 - 07:54 AM #12

You are welcome!


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • elsevero
  • Newbie
  • Members
  • Join Date: 07-Oct 09
  • 6 posts

Posted 02 September 2017 - 09:28 AM #13

Is there any way to disable browser language detection? Beside modifying the source code, after an update the changes are gone...

Not recommended :)



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11406 posts

Posted 02 September 2017 - 08:16 PM #14

No.  They set a couple of constants after language is detected and there are not hooks in place to allow you to override it.  In fact, I'm not sure hooks have been initialized at that point in the process.  So core code is only solution since you can't reset the constants.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19797 posts

Posted 04 September 2017 - 06:55 AM #15

Is there any way to disable browser language detection? Beside modifying the source code, after an update the changes are gone...

Not recommended :)

 

Language is detected from $_SERVER['HTTP_ACCEPT_LANGUAGE'] value. You can use any hook which is used before the fn_init_language function is called to override this value


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11406 posts

Posted 04 September 2017 - 07:18 PM #16

Language is detected from $_SERVER['HTTP_ACCEPT_LANGUAGE'] value. You can use any hook which is used before the fn_init_language function is called to override this value

I don't think "fn_init_controllers" is done before the language is initialized (part of 'config' not 'init') hence the call to fn_register_hooks() would be later in the initialization process.  I believe the only solution is a core change or some type of detection/action in either config.local.php or local_conf.php (I'd recommend the latter).  One could then manipulate the HTTP_ACCEPT_LANGUAGE value but it wouldn't affect the browser language (though they are probably one in the same at that point).


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19797 posts

Posted 05 September 2017 - 07:30 AM #17

I don't think "fn_init_controllers" is done before the language is initialized (part of 'config' not 'init') hence the call to fn_register_hooks() would be later in the initialization process.  I believe the only solution is a core change or some type of detection/action in either config.local.php or local_conf.php (I'd recommend the latter).  One could then manipulate the HTTP_ACCEPT_LANGUAGE value but it wouldn't affect the browser language (though they are probably one in the same at that point).

 

For example, addons are loaded before the language is initiated. So I think, it is possible to make required changes with module


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11406 posts

Posted 05 September 2017 - 06:22 PM #18

I believe fn_init_languages() is run before fn_run_controllers(), hence any 'defines' will be set before any hooks are called or pre controllers are run.  There's a difference between "loading" the addons (part of the config process) and "running" them (after config and init) where the hooks would be executed.  The problem is that the language settings are constants (defines) where they should be in the registry so they could be manipulated.

 

Where do you propose  changing HTTP_ACCEPT_LANGUAGE to affect the CART_LANGUAGE constant?  I just don't think you can without modifying the fn_init_languages() function.  But I'd certainly be interested in knowing how to do it.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19797 posts

Posted 06 September 2017 - 06:06 AM #19

Where do you propose  changing HTTP_ACCEPT_LANGUAGE to affect the CART_LANGUAGE constant?  I just don't think you can without modifying the fn_init_languages() function.  But I'd certainly be interested in knowing how to do it.

 

For example, it can be done in the init.php file of the addon


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11406 posts

Posted 06 September 2017 - 06:16 PM #20

For example, it can be done in the init.php file of the addon

Have you verified that this affects the CART_LANGUAGE constant?  I believe that fn_init_languages() is run before any addon init'.php files.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.