[vhffs-dev] [svn] commit: r110 - in /trunk: vhffs-api/src/Vhffs/Panel/Main.pm vhffs-panel/auth.pl vhffs-panel/subscribe.pl vhffs-panel/templates/main/auth.tmpl vhffs-panel/themes/default/main.css

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Author: soda
Date: Thu Dec 15 12:15:19 2005
New Revision: 110

Log:
Add internationalisation for ALL panel


Modified:
    trunk/vhffs-api/src/Vhffs/Panel/Main.pm
    trunk/vhffs-panel/auth.pl
    trunk/vhffs-panel/subscribe.pl
    trunk/vhffs-panel/templates/main/auth.tmpl
    trunk/vhffs-panel/themes/default/main.css

Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm Thu Dec 15 12:15:19 2005
@@ -16,6 +16,20 @@
 use Vhffs::Panel::Menu;
 use Vhffs::Panel::User;
 
+sub select_lang
+{
+	use Vhffs::Intl;
+	my $main = shift;
+	my $txt = "";
+	my $langs = Vhffs::Intl::get_languages( $main );
+	my $l;
+	foreach $l ( @{$langs} )
+	{
+		$txt .= "<option name=i\"$l\">$l</option>";
+	}
+	return $txt;
+}
+
 sub cook_lang
 {
 	use CGI;
@@ -27,26 +41,19 @@
 	$vhffs = shift;
 	$cgi = new CGI;
 
-	if( ! CGI->cookie( "lang" ) )
-	{
-		if( CGI->param( "lang" ) )
-		{
-			$lang = CGI->param( "lang" );
-			$cookie = CGI->cookie( "lang" => $lang );
-		}
-		else
-		{
-			return;
-		}
-	}
-	else
-	{
-		$cookie = CGI->cookie( "lang" );
+	if( $cgi->param( "lang" ) )
+	{
+		$lang = $cgi->param( "lang" );
+		$cookie = CGI->cookie( "lang" => $lang );
+	}
+	elsif( CGI->cookie( "lang" ) )
+	{
+		$lang = CGI->cookie( "lang" );
 	}
 	setlocale(LC_ALL, $lang   );
 	bindtextdomain("vhffs", $vhffs->get_config->get_intldir);
 	textdomain("vhffs");
-
+	return $cookie;
 }
 
 sub new

Modified: trunk/vhffs-panel/auth.pl
==============================================================================
--- trunk/vhffs-panel/auth.pl (original)
+++ trunk/vhffs-panel/auth.pl Thu Dec 15 12:15:19 2005
@@ -29,6 +29,9 @@
 $template->param( TEXT_LOGIN => gettext("Login") );
 $template->param( TEXT_LOSTPASSWORD => gettext("I've lost my password") );
 $template->param( TEXT_SUBSCRIBE => gettext("Subscribe") );
+$template->param( CHANGE_TEXT => gettext("change") );
+$template->param( LANG_TEXT => gettext("Language") );
+$template->param( LANGS => Vhffs::Panel::Main::select_lang( $vhffs ) );
 
 
 if( $vhffs->get_config->stats_on_home == 1 )
@@ -48,4 +51,11 @@
     $template->param( TEXT_PUBLIC => gettext( "Go to public area" ) );
 }
 
-display_light Vhffs::Panel::Main( $template );
+if( defined $cookie )
+{
+	display_light Vhffs::Panel::Main( $template , $cookie );
+}
+else
+{
+	display_light Vhffs::Panel::Main( $template );
+}

Modified: trunk/vhffs-panel/subscribe.pl
==============================================================================
--- trunk/vhffs-panel/subscribe.pl (original)
+++ trunk/vhffs-panel/subscribe.pl Thu Dec 15 12:15:19 2005
@@ -16,10 +16,9 @@
 my $templatedir 	= $vhffs->get_config->get_templatedir;
 my $template;
 my $confirmation;
-setlocale(LC_ALL, CGI->cookie("language") );
-bindtextdomain("vhffs", $vhffs->get_config->get_intldir);
-textdomain("vhffs");
 
+
+Vhffs::Panel::Main::cook_lang( $vhffs );
 
 if( $vhffs->get_config->get_allow_subscribe == 0 )
 {

Modified: trunk/vhffs-panel/templates/main/auth.tmpl
==============================================================================
--- trunk/vhffs-panel/templates/main/auth.tmpl (original)
+++ trunk/vhffs-panel/templates/main/auth.tmpl Thu Dec 15 12:15:19 2005
@@ -10,6 +10,17 @@
 
 	</head>
 	<body>
+		<div id="chooselang">
+			<form method="post" action="auth.pl">
+			<tmpl_var name="LANG_TEXT">:	
+			<br/>
+				<select name="lang">
+				<tmpl_var name="LANGS">	
+				</select>
+				<br/>
+				<input type="submit" value="<tmpl_var name="CHANGE_TEXT">" />
+			</form>
+		</div>
 
 		<div class="logo">
 		</div>

Modified: trunk/vhffs-panel/themes/default/main.css
==============================================================================
--- trunk/vhffs-panel/themes/default/main.css (original)
+++ trunk/vhffs-panel/themes/default/main.css Thu Dec 15 12:15:19 2005
@@ -7,6 +7,20 @@
 	background-color: #869fd2;
 	font-family:"Trebuchet MS",Verdana,Geneva,Arial,Helvetica,sans-serif;
 }
+
+#chooselang form
+{
+	text-align: center;
+	width: 30%;
+}
+
+#chooselang
+{
+	right: 10%;
+	top: 5%;
+	position: absolute;
+}
+
 
 .foothome a
 {




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/