<Solved>login.php cannot switch the language

Get help with installation and running official modules for phpwcms here. Please do not post bug reports or feature requests here.
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

sunny123 wrote:
DeXXus wrote:This may be a dumb question. Is your browser encoding set properly to English?
Can you help me to change the login.php to set properly langage from people choose, and from browser enconding too?
Does this mean that it DID make a difference?

There's an OLD discussion linked below that was regarding the order in which browser detection and backend settings are tested. perhaps you can get something out of it? ( I was scolded back then ;-) )

http://www.phpwcms.de/forum/viewtopic.php?t=9536
sunny123
Posts: 52
Joined: Wed 26. Sep 2007, 02:11

Post by sunny123 »

DeXXus wrote: Does this mean that it DID make a difference?

There's an OLD discussion linked below that was regarding the order in which browser detection and backend settings are tested. perhaps you can get something out of it? ( I was scolded back then ;-) )

http://www.phpwcms.de/forum/viewtopic.php?t=9536
NO! There is nothing I want.
I want to user can choose login.php language, how to edit the login.php code?
sunny123
Posts: 52
Joined: Wed 26. Sep 2007, 02:11

Post by sunny123 »

Why nobody understand me?


Anybody can help me?
Last edited by sunny123 on Thu 11. Oct 2007, 03:13, edited 1 time in total.
User avatar
Heiko H.
Posts: 868
Joined: Thu 27. Oct 2005, 11:41
Location: Dresden
Contact:

Post by Heiko H. »

Hi sunny123,

choose the language you want. Leave the datafields (login, password) emty and press the login-Button.

Good luck, Heiko...
sunny123
Posts: 52
Joined: Wed 26. Sep 2007, 02:11

Post by sunny123 »

Heiko H. wrote:Hi sunny123,

choose the language you want. Leave the datafields (login, password) emty and press the login-Button.

Good luck, Heiko...
Yes, you are right!
But it is not the correct procedure!
User avatar
Heiko H.
Posts: 868
Joined: Thu 27. Oct 2005, 11:41
Location: Dresden
Contact:

Post by Heiko H. »

But it is not the correct procedure!
Right, but it works :wink:

May be a bug report is the right way :?:
http://sourceforge.net/tracker/?group_i ... tid=607698


Regards, Heiko...
sunny123
Posts: 52
Joined: Wed 26. Sep 2007, 02:11

Post by sunny123 »

Heiko H. wrote:
But it is not the correct procedure!
Right, but it works :wink:

May be a bug report is the right way :?:
http://sourceforge.net/tracker/?group_i ... tid=607698


Regards, Heiko...
Hello Heiko,
I'm sorry, my english is poor, I mean that directly turns English page without pressing the login-Button, may I?
Goran
Posts: 81
Joined: Thu 27. Nov 2003, 11:43
Location: Zagreb, Croatia
Contact:

Post by Goran »

sunny123 wrote: I mean that directly turns English page without pressing the login-Button, may I?
No, not possible without hacking the code,
sunny123
Posts: 52
Joined: Wed 26. Sep 2007, 02:11

Post by sunny123 »

Goran wrote:
sunny123 wrote: I mean that directly turns English page without pressing the login-Button, may I?
No, not possible without hacking the code,

It is possible,why?
Last edited by sunny123 on Sat 6. Oct 2007, 03:47, edited 1 time in total.
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

[UPDATE] Post deleted - makes NO sense! and does NOT help!
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

are you shure that you haven't change something else ?

have tested it now

on a older Version

Edit - shure it will shows a Login-Error ;) this is not a Bug - it's a Feature :lol: 'cause the Username and Password are wrong - hehe all what the changed Code does is to reload the Form like you have clicked on 'Submit'

Second Edit

to solve this Problem too here a little Codechange

Code: Select all

...
<div id="loginForm" style="display:none;">

<!-- New Language Selection Part now here (pico) -->
<form name="login_lang" method="post" action="login.php" style="margin:0;padding:0;">
	<table border="0" cellpadding="0" cellspacing="0" summary="Login Form" style="margin:15px 0 20px 10px">
   <tr>
     <td align="right" nowrap="nowrap" class="v10"><?php echo $BL["login_lang"] ?>:&nbsp;</td>
     <td class="v10">
       <select name="form_lang" onchange="this.form.submit();" id="form_lang" style="width:250px;">
       <?php
         // check available languages installed and build language selector menu
         $lang_dirs = opendir(PHPWCMS_ROOT.'/include/inc_lang/backend');
         $lang_code = array();
         while($lang_codes = readdir( $lang_dirs )) {
         	if( $lang_codes != "." && $lang_codes != ".." && file_exists(PHPWCMS_ROOT.'/include/inc_lang/backend/'.$lang_codes."/lang.inc.php")) {
         		$lang_code[$lang_codes]  = '<option value="'.$lang_codes.'"';
         		$lang_code[$lang_codes] .= ($lang_codes == $_SESSION["wcs_user_lang"]) ? ' selected="selected"' : '';
         		$lang_code[$lang_codes] .= '>';
         		$lang_code[$lang_codes] .= (isset($BL[strtoupper($lang_codes)])) ? $BL[strtoupper($lang_codes)] : strtoupper($lang_codes);
         		$lang_code[$lang_codes] .= '</option>';
         	}
         }
         closedir( $lang_dirs );
         ksort($lang_code);
	       	echo implode(LF, $lang_code);
       ?>
       </select>
     </td>
   </tr>
 </table> 
</form>       
<!-- END modifikation -->

<form name="login_formular" method="post" action="login.php" autocomplete="off" style="margin:0;padding:0;">
...
and some Lines down

Code: Select all

	
...
<table border="0" cellpadding="0" cellspacing="0" summary="Login Form" style="margin:15px 0 20px 10px">
        <tr>
          <td align="right" nowrap="nowrap" class="v10"><?php echo $BL["login_username"] ?>:&nbsp;</td>
          <td class="v10"><input name="form_loginname" type="text" id="form_loginname" style="width:250px;" size="30" maxlength="30" value="<?php echo html_specialchars($wcs_user); ?>"></td>
          </tr>
        <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="3"></td></tr>
        <tr>
          <td align="right" nowrap="nowrap" class="v10"><?php echo $BL["login_userpass"] ?>:&nbsp;</td>
          <td class="v10"><input name="form_password" type="password" id="form_password" style="width:250px;" size="30" maxlength="20"></td>
          </tr>
        <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="4"></td></tr>

<!-- here was the Language Selection Part - moved up //-->

        <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10"></td></tr>
        <tr>
          <td>&nbsp;</td>
          <td><input name="Submit" type="submit" value="<?php echo $BL["login_button"] ?>"><input name="form_aktion" type="hidden" id="form_aktion" value="login"></td>
          </tr>
    </table>
...
Last edited by pico on Mon 1. Oct 2007, 18:58, edited 1 time in total.
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
sunny123
Posts: 52
Joined: Wed 26. Sep 2007, 02:11

Post by sunny123 »

hello pico
A question:Why has to change the position? Can you not to change it?
Last edited by sunny123 on Thu 11. Oct 2007, 03:12, edited 1 time in total.
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update »

to lend a helping hand :wink:

You now can
first: select a login screen language without errors :idea:
second: log in :!:
third: backend language is selected from user details?

:)
User avatar
Oliver Georgi
Site Admin
Posts: 9920
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

STOP hacking code!!!!!!

Here is why everything is correct - it is NOT a bug!!!

Default language of your site is defined in conf.inc.php.

Code: Select all

$phpwcms["default_lang"]      = "en";     //default language
If you direct your browser to login.php a session is opened and default language is set to above value. Then phpwcms is checking your browser's language setting - here are the related screenshots for IE7 and FireFox.

Image

Image

If default browser language is available in phpwcms it will automatically switch to this language otherwise if will fall back to phpwcms' default language setting.

It makes no sense to set to any another language than browser's default as long as your are not logged in! So check this value first.

After successful login user related language setting will be loaded.

Oliver
Last edited by Oliver Georgi on Mon 1. Oct 2007, 19:08, edited 2 times in total.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

was just a litlle Hack to show you the direction -

but I'm not hired by your Company ;)
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
Post Reply