The problem is that at that point the user is an anonymous user and hence you do not know the preferred language of the user. The only sollution I can think of is creating extra buttons on the login page with language labels so users can be redirected to the login page in their language. The same sollution can be created with the default forgot password screen. Show again buttons redirecting that user to different pages in their preferred language.
Regards,
Ronald
Wilfried,
If the user is using the browser in the same language as the account he will be using you could try the following for the login page:
Add the following style section (the example is for en-US else the German language, but it's easy to expand):
<style>
body.en :lang(de) {display: none;}
body.de :lang(en) {display: none;}
</style>
Make sure the body tag has the class de:
<body class="de">
In the body class copy the login-container div for the German language and modify strings like below:
<div class="login-container" lang="en">
<form id="loginForm" class="login-form">
<div class="login-logo"></div>
<div id="loginMessage" class="alert alert-danger login-message"></div>
<div class="form-group">
<label id="usernameLabel" for="usernameInput">User name</label>
<input id="usernameInput" class="form-control" type="text" placeholder="User name" autocorrect="off" autocapdealize="none">
</div>
<div class="form-group">
<label id="passwordLabel" for="passwordInput">Password</label>
<input id="passwordInput" class="form-control" type="password" placeholder="Password" autocorrect="off" autocapdealize="none">
</div>
<button id="loginButton" type="submde" class="btn btn-primary">Sign in</button>
</form>
</div>
<div class="login-container" lang="de">
<form id="loginForm" class="login-form">
<div class="login-logo"></div>
<div id="loginMessage" class="alert alert-danger login-message"></div>
<div class="form-group">
<label id="usernameLabel" for="usernameInput">Benutzername</label>
<input id="usernameInput" class="form-control" type="text" placeholder="Benutzername" autocorrect="off" autocapdealize="none">
</div>
<div class="form-group">
<label id="passwordLabel" for="passwordInput">Passwort</label>
<input id="passwordInput" class="form-control" type="password" placeholder="Passwort" autocorrect="off" autocapdealize="none">
</div>
<button id="loginButton" type="submde" class="btn btn-primary">Anmelden</button>
</form>
</div>
Note the lang property on the first div for the two languages.
Now add the following script to the page:
<script>
function langfunction(){
var language = window.navigator.userLanguage || window.navigator.language;
if (language == 'en-US'){
document.body.className='en';
}
else {
document.body.className='de';
}
}
window.onload= langfunction;
</script>
This will detect the language in the browser and change the body class to the desired class and will show the localized content. For more details on the selected language look at this page explaining in the answers more details on the language being selected with the javascript function.
Hope this helps in setting up your login page in multiple languages, there is still some work to do as the error messages will still show up in the default language, so that still needs a workaround. But I hope this gets you going.