https://www.opencart.com/index.php?rout ... 20currency
viewtopic.php?t=230979
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Code: Select all
// Language
$code = '';
$this->load->model('localisation/language');
$languages = $this->model_localisation_language->getLanguages();
if (isset($this->session->data['language'])) {
$code = $this->session->data['language'];
}
if (isset($this->request->cookie['language']) && !array_key_exists($code, $languages)) {
$code = $this->request->cookie['language'];
}
// Language Detection
if (!empty($this->request->server['HTTP_ACCEPT_LANGUAGE']) && !array_key_exists($code, $languages)) {
$detect = '';
$browser_languages = explode(',', $this->request->server['HTTP_ACCEPT_LANGUAGE']);
// Try using local to detect the language
foreach ($browser_languages as $browser_language) {
foreach ($languages as $key => $value) {
if ($value['status']) {
$locale = explode(',', $value['locale']);
if (in_array($browser_language, $locale)) {
$detect = $key;
break 2;
}
}
}
}
if (!$detect) {
// Try using language folder to detect the language
foreach ($browser_languages as $browser_language) {
if (array_key_exists(strtolower($browser_language), $languages)) {
$detect = strtolower($browser_language);
break;
}
}
}
$code = $detect ? $detect : '';
}
if (!array_key_exists($code, $languages)) {
$code = $this->config->get('config_language');
}
if (!isset($this->session->data['language']) || $this->session->data['language'] != $code) {
$this->session->data['language'] = $code;
}
if (!isset($this->request->cookie['language']) || $this->request->cookie['language'] != $code) {
setcookie('language', $code, time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']);
}
viewtopic.php?t=221079#p805659
viewtopic.php?t=206944
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
ok let me rephrase my question then how can i just make dutch my primary langauge no mather what,by mona wrote: ↑Wed Mar 22, 2023 4:49 ambrowser language and ip location are two different things
viewtopic.php?t=221079#p805659
viewtopic.php?t=206944
ii just need to load my website in dutch no mather browser language and have english as an option peopel can switch to if they dont speak dutch
You can check by clearing your browser cookies or post your webpage and someone can check.
If you are not sure how to clear your cookies (and ideally you just want to your site cookies specifically) you can search google, these used to be correct.
https://support.google.com/chrome/answer/95647?hl=en
https://support.mozilla.org/en-US/kb/en ... references
http://www.opera.com/help/tutorials/security/cookies/
https://support.apple.com/en-us/HT201265
https://privacy.microsoft.com/en-us/win ... nd-privacy
As an example you can see this in the inspector. Right click on the language and you can delete just that cookie.
Once you are sure it is deleted you can refresh your browser and it should be in Dutch
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
I tried clearing all site cookies and data and even using different browser it still auto detects the langauge of the browser and set the language to english if the browser is englishby mona wrote: ↑Wed Mar 22, 2023 6:24 amIt should do that if the default is set to dutch, as an additional safeguard put sort order as dutch 1 and english 2
You can check by clearing your browser cookies or post your webpage and someone can check.
If you are not sure how to clear your cookies (and ideally you just want to your site cookies specifically) you can search google, these used to be correct.
https://support.google.com/chrome/answer/95647?hl=en
https://support.mozilla.org/en-US/kb/en ... references
http://www.opera.com/help/tutorials/security/cookies/
https://support.apple.com/en-us/HT201265
https://privacy.microsoft.com/en-us/win ... nd-privacy
As an example you can see this in the inspector. Right click on the language and you can delete just that cookie.
Once you are sure it is deleted you can refresh your browser and it should be in Dutch
Screen-Shot-2023-03-21-at-22.26.15.png
? You browse in English but want it to default to Dutch ..
catalog/controller/startup/startup.php
replace
Code: Select all
if (!$detect) {
// Try using language folder to detect the language
foreach ($browser_languages as $browser_language) {
if (array_key_exists(strtolower($browser_language), $languages)) {
$detect = strtolower($browser_language);
break;
}
}
}
Code: Select all
if (!$detect) {
$detect= 'nl-nl';
}
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Users browsing this forum: ravikumar22 and 82 guests