0

I've started working on an existing PHP website and previous developers used cookies to set languages, I'm not familiar with this approach since I prefer to use explicit routing.

So my concern is I want to set a default language for the visitors in their first visit. What I know about cookies that they will set the language based on the browser of the user, but the website is always showing one language (langA) regardless of the browser settings. And I want langB to be the default one.

Sample of Translate Javascript:

var webContentVar = {
        "header-translate":{
            "langA":{
                "home":"1",
                "about":"2,
            },
            "langB":{
                "home":"11",
                "about":"22",
            },
        },
     }

Unfortunately I don't know how this works, but I've seen someone talking about the same approach here:

https://stackoverflow.com/a/2400221/10773318

Thank you in advance.

IMSoP
  • 77,988
  • 8
  • 99
  • 149
roo
  • 99
  • 1
  • 11
  • That code just sets a variable, it doesn't tell us anything about what *reads* that variable. It's probably the settings for some library, so find out what, and find its documentation. If you can't find out how to do it, you can come back and ask a new targeted question naming the library. At the moment someone would have to guess the library, then write an answer, and if they guessed wrong would waste their time and yours. – IMSoP Mar 20 '22 at 09:53

0 Answers0