Jump to content

Solved: Don't change backend language


SebastianP
 Share

Recommended Posts

Hi there, 

I've build a website with a language switch. If the user is logged in in the same browser, the website displays also an "edit"-button, whitch opens the page in the backend - thats why I cannot 2 different browsers for viewing/editing. So far, so good:-) But if I change the language in the frontend ($user->language = ...), the language in the backend is also changed - that's not so good, because not all pages are translated and have titles in the other language. 

Is there a way to force the backend language to the logged in users default language? Or can I set the language of the frontend without change the users language? 

Thank you in advance, regards
Sebastian

Link to comment
Share on other sites

You could build some custom logic into templates/admin.php to switch the language to something else temporarily. But by default switching languages for users does use one and the same field to store that switch. So you'd probably need to add another field to the user to store something like a "backend_language".

  • Like 2
Link to comment
Share on other sites

Thank you very much for the idea - a simple "wire("user")->language = wire("languages")->get("name=default");" on the top of the admin template does the job (in this case all admin users use the default language, so a separate field is not necessary)

Regards

Sebastian

  • Like 1
Link to comment
Share on other sites

  • SebastianP changed the title to Solved: Don't change backend language

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...