Set Default Language

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

Hi

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

Also....

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

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

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.

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

Take a look at GeoIP Languages

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

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

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');

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 !

You are welcome!

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

Not recommended :)

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.

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

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

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

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.

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

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.