From e531d8d5b299bd69c53922ce51a71a3cb1ac70e2 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sun, 27 Jun 2004 16:27:36 +0000 Subject: [PATCH] fixing some more bugs introduced from the new i18n system --- docs/upgrades/upgrade_6.0.3-6.1.0.pl | 6 +++--- lib/WebGUI/International.pm | 5 ++++- lib/WebGUI/Session.pm | 5 ----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/upgrades/upgrade_6.0.3-6.1.0.pl b/docs/upgrades/upgrade_6.0.3-6.1.0.pl index f2d9e3d9b..5d7b0e279 100644 --- a/docs/upgrades/upgrade_6.0.3-6.1.0.pl +++ b/docs/upgrades/upgrade_6.0.3-6.1.0.pl @@ -67,9 +67,9 @@ my $langs = { 16 => "Polish", 21 => "Russian" }; -WebGUI::SQL->write("update userProfileField set dataDefault='[\'".$langs->{$defaultLangId}."\']' where fieldName='language'"); -WebGUI::SQL->write("update userProfileData set language='".$langs->{$defaultLangId}."' where fieldName='language' and fieldData<>1"); -WebGUI::SQL->write("update userProfileData set language='English' where fieldName='language' and fieldData=1"); +WebGUI::SQL->write("update userProfileField set dataDefault=".quote("['".$langs->{$defaultLangId}."']")." where fieldName='language'"); +WebGUI::SQL->write("update userProfileData set fieldData='".$langs->{$defaultLangId}."' where fieldName='language' and fieldData<>1"); +WebGUI::SQL->write("update userProfileData set fieldData='English' where fieldName='language' and fieldData=1"); WebGUI::Session::close(); diff --git a/lib/WebGUI/International.pm b/lib/WebGUI/International.pm index f41feaff9..1ed54ba10 100644 --- a/lib/WebGUI/International.pm +++ b/lib/WebGUI/International.pm @@ -84,9 +84,12 @@ sub get { my $cmd = "WebGUI::i18n::".$language."::".$namespace; my $load = "use ".$cmd; eval($load); + WebGUI::ErrorHandler::warn($cmd." failed to compile because ".$@) if ($@); $cmd = "\$".$cmd."::I18N->{'".$id."'}"; my $output = eval($cmd); - return $output || get($id,$namespace,"English"); + WebGUI::ErrorHandler::warn("Couldn't get value from ".$cmd." because ".$@) if ($@); + $output = get($id,$namespace,"English") if ($output eq "" && $language ne "English"); + return $output; } diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm index e8b6d9995..6e7c00993 100644 --- a/lib/WebGUI/Session.pm +++ b/lib/WebGUI/Session.pm @@ -431,11 +431,6 @@ sub open { ###---------------------------- ### current user's account and profile information (from users and userProfileData tables) _setupUserInfo($session{var}{userId}); - ###---------------------------- - ### language settings - $session{language} = WebGUI::SQL->quickHashRef("select * from language where languageId=".quote($session{user}{language})); - ###---------------------------- - ### loading plugins } #-------------------------------------------------------------------