如何更改页面语言而不刷新MVC模型?

In the settings.php i have some input for the realname,hobby,city and select tag for the languages

The html form is easy and i'm not going to copy it :)

This is the php code for the form

<?php
if(isset($_POST['submit'])){


  if($this->edit->process()){
    $s = 1; 
  }

}

if($s){echo '<p id="success">Success</p>';}

?>

This is in the view file and when the form is submit the $this->edit = the model for the updating the user data.

Everything work really good but in head.php there is this code

<?php $lang = $this->lange('global',$this->getUser->language($_SESSION['userID']));?>

With him this get the user current language and after that load the file with lange()

So if the submit is like this,the inputs and select tag are changing with what the user have choicen but the to see the new language they have to refresh the page. This is not good,because the user may be confuced that they did something wrong.

But if the form with method="POST" the page is refreshing and still with the old language

  1. It is going to be quite hard to change all the texts in the DOM model to make the language change without redirect. I doubt it's really your desire.
  2. You ought to make a GET method redirect after processing any POST form. So, instead of printing whatever "success" messages you have to reload the page.
  3. Using session to store the language is not good method, the language have to be set by means of the page address - a subdomain (preferable) or a virtual directory.