*

7ala

  • ****
  • 144 posts
Is there a way
So that if the user opens the multilingual website
The site is displayed according to the user's language

thank you

*

MB Themes

Re: Open the site according to the language of the user's browser
« Reply #1 on: July 22, 2021, 01:35:13 PM »
@7ala
Most probably not, as standard locales are different to ones used by osclass and it may be hard to do some kind of mapping.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

7ala

  • ****
  • 144 posts
Re: Open the site according to the language of the user's browser
« Reply #2 on: October 13, 2021, 08:35:49 AM »
I found an addon that does that, but unfortunately
The site is getting a little slow
Addition name auto_language
This code is from inside the addon

Code: [Select]
<?php
/*
Plugin Name: Auto Language
Description: Choose an automatic language base on browser language
Version: 1.0
Author: Guillermo Parraguez
Short Name: aLanguage
Plugin update URI: auto-language
*/

function check_language () {
$browser str_replace("-","_",substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 05)); //language in the browser
$list  osc_get_locales(); //list of languages in osclass
$current  osc_current_user_locale(); //current language in osclass


if(!isset($_COOKIE['osc_auto_language']) && !isset($_GET['auto'])){
setcookie("osc_auto_language"truetime()+60*60*24*90"/");
if($current != $browser){
foreach ($list as $lan_code) {
if($browser == $lan_code['pk_c_code']){
header("Location: index.php?page=language&auto=true&locale=".$browser);
}
}
}
}
}
osc_add_hook('init'check_language());

?>

Is there an error
Because it works some of the time
And other times it doesn't work

*

MB Themes

Re: Open the site according to the language of the user's browser
« Reply #3 on: October 13, 2021, 08:55:15 AM »
@7ala
Does not looks to be issue there.
Maybe try to add after line:
Code: [Select]
header("Location: index.php?page=language&auto=true&locale=".$browser);
Exit command
Code: [Select]
exit;
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

7ala

  • ****
  • 144 posts
Re: Open the site according to the language of the user's browser
« Reply #4 on: October 13, 2021, 09:02:04 AM »
I did the experiment
But the site speed is less than
70 to 48
cause slow
Is there a solution?

*

MB Themes

Re: Open the site according to the language of the user's browser
« Reply #5 on: October 13, 2021, 11:13:52 AM »
@7ala
Piece of code you put there does not seem to have any relation to speed of your site
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

tomi327

  • ***
  • 67 posts
Re: Open the site according to the language of the user's browser
« Reply #6 on: October 13, 2021, 03:31:16 PM »
Auto language plugin is needed for osclass, I think. Osclasspoint ? Hmm?  ;)

*

MB Themes

Re: Open the site according to the language of the user's browser
« Reply #7 on: October 14, 2021, 12:00:02 PM »
Auto language plugin is needed for osclass, I think. Osclasspoint ? Hmm?  ;)

 :-\
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots